Force TARGET_TB_PCREL to 1

This commit is contained in:
Andrea Fioraldi 2022-10-17 18:03:15 +02:00
parent 97211a7b7c
commit c3a14af2d3
3 changed files with 11 additions and 2 deletions

View File

@ -1054,9 +1054,10 @@ int cpu_exec(CPUState *cpu)
//// --- Begin LibAFL code ---
#if !TARGET_TB_PCREL
if (last_tb->jmp_reset_offset[1] != TB_JMP_RESET_OFFSET_INVALID) {
mmap_lock();
TranslationBlock *edge = libafl_gen_edge(cpu, last_tb->pc, tb->pc,
TranslationBlock *edge = libafl_gen_edge(cpu, tb_pc(last_tb), tb_pc(tb),
tb_exit, cs_base, flags, cflags);
mmap_unlock();
@ -1069,6 +1070,10 @@ int cpu_exec(CPUState *cpu)
} else {
tb_add_jump(last_tb, tb_exit, tb);
}
#else
// No party if TARGET_TB_PCREL is 1
tb_add_jump(last_tb, tb_exit, tb);
#endif
//// --- End LibAFL code ---
}

View File

@ -2062,7 +2062,9 @@ TranslationBlock *libafl_gen_edge(CPUState *cpu, target_ulong src_block,
gen_code_buf = tcg_ctx->code_gen_ptr;
tb->tc.ptr = tcg_splitwx_to_rx(gen_code_buf);
#if !TARGET_TB_PCREL
tb->pc = pc;
#endif
tb->cs_base = cs_base;
tb->flags = flags;
tb->cflags = cflags;
@ -2102,7 +2104,7 @@ TranslationBlock *libafl_gen_edge(CPUState *cpu, target_ulong src_block,
tcg_ctx->cpu = NULL;
max_insns = tb->icount;
trace_translate_block(tb, tb->pc, tb->tc.ptr);
trace_translate_block(tb, pc, tb->tc.ptr);
/* generate machine code */
tb->jmp_reset_offset[0] = TB_JMP_RESET_OFFSET_INVALID;

View File

@ -33,6 +33,8 @@
#include "cpu-param.h"
#define TARGET_TB_PCREL 1
#ifndef TARGET_LONG_BITS
# error TARGET_LONG_BITS must be defined in cpu-param.h
#endif