diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c index 5bf46ff23f..05a672960a 100644 --- a/accel/tcg/tb-maint.c +++ b/accel/tcg/tb-maint.c @@ -866,11 +866,11 @@ static inline void tb_jmp_unlink(TranslationBlock *dest) TB_FOR_EACH_JMP(dest, tb, n) { tb_reset_jump(tb, n); - //// --- Begin LibAFL code --- - if (tb->flags & 0x04000000) { +//// --- Begin LibAFL code --- + if (tb->cflags & CF_IS_EDGE) { tb_phys_invalidate(tb, -1); } - //// --- End LibAFL code --- +//// --- End LibAFL code --- qatomic_and(&tb->jmp_dest[n], (uintptr_t)NULL | 1); /* No need to clear the list entry; setting the dest ptr is enough */ } diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 14b22730a5..462f84c278 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -332,8 +332,6 @@ static target_ulong reverse_bits(target_ulong num) return reverse_num; } -#define IS_EDGE 0x04000000 - /* Called with mmap_lock held for user mode emulation. */ TranslationBlock *libafl_gen_edge(CPUState *cpu, target_ulong src_block, target_ulong dst_block, int exit_n, @@ -404,8 +402,8 @@ TranslationBlock *libafl_gen_edge(CPUState *cpu, target_ulong src_block, tb->pc = pc; } tb->cs_base = cs_base; - tb->flags = flags | IS_EDGE; - tb->cflags = cflags; + tb->flags = flags; + tb->cflags = cflags | CF_IS_EDGE; //tb_set_page_addr0(tb, phys_pc); //tb_set_page_addr1(tb, -1); tcg_ctx->gen_tb = tb; diff --git a/include/exec/translation-block.h b/include/exec/translation-block.h index 48211c890a..6d899c161a 100644 --- a/include/exec/translation-block.h +++ b/include/exec/translation-block.h @@ -77,6 +77,9 @@ struct TranslationBlock { #define CF_PARALLEL 0x00008000 /* Generate code for a parallel context */ #define CF_NOIRQ 0x00010000 /* Generate an uninterruptible TB */ #define CF_PCREL 0x00020000 /* Opcodes in TB are PC-relative */ +//// --- Begin LibAFL code --- +#define CF_IS_EDGE 0x00800000 /* The current TB is an edge */ +//// --- End LibAFL code --- #define CF_CLUSTER_MASK 0xff000000 /* Top 8 bits are cluster ID */ #define CF_CLUSTER_SHIFT 24