Accel TCG fixes
This commit is contained in:
parent
322a792ffa
commit
8794d3fdc8
@ -1010,7 +1010,7 @@ cpu_exec_loop(CPUState *cpu, SyncClocks *sc)
|
|||||||
//// --- Begin LibAFL code ---
|
//// --- Begin LibAFL code ---
|
||||||
|
|
||||||
#if !TARGET_TB_PCREL
|
#if !TARGET_TB_PCREL
|
||||||
if (last_tb->jmp_reset_offset[1] != TB_JMP_RESET_OFFSET_INVALID) {
|
if (last_tb->jmp_reset_offset[1] != TB_JMP_OFFSET_INVALID) {
|
||||||
mmap_lock();
|
mmap_lock();
|
||||||
TranslationBlock *edge = libafl_gen_edge(cpu, tb_pc(last_tb), tb_pc(tb),
|
TranslationBlock *edge = libafl_gen_edge(cpu, tb_pc(last_tb), tb_pc(tb),
|
||||||
tb_exit, cs_base, flags, cflags);
|
tb_exit, cs_base, flags, cflags);
|
||||||
|
@ -1016,7 +1016,9 @@ TranslationBlock *libafl_gen_edge(CPUState *cpu, target_ulong src_block,
|
|||||||
tb->flags = flags;
|
tb->flags = flags;
|
||||||
tb->cflags = cflags;
|
tb->cflags = cflags;
|
||||||
tb->trace_vcpu_dstate = *cpu->trace_dstate;
|
tb->trace_vcpu_dstate = *cpu->trace_dstate;
|
||||||
tcg_ctx->tb_cflags = cflags;
|
//tb_set_page_addr0(tb, phys_pc);
|
||||||
|
//tb_set_page_addr1(tb, -1);
|
||||||
|
tcg_ctx->gen_tb = tb;
|
||||||
|
|
||||||
#ifdef CONFIG_PROFILER
|
#ifdef CONFIG_PROFILER
|
||||||
/* includes aborted translations because of exceptions */
|
/* includes aborted translations because of exceptions */
|
||||||
@ -1053,18 +1055,6 @@ TranslationBlock *libafl_gen_edge(CPUState *cpu, target_ulong src_block,
|
|||||||
|
|
||||||
trace_translate_block(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;
|
|
||||||
tb->jmp_reset_offset[1] = TB_JMP_RESET_OFFSET_INVALID;
|
|
||||||
tcg_ctx->tb_jmp_reset_offset = tb->jmp_reset_offset;
|
|
||||||
if (TCG_TARGET_HAS_direct_jump) {
|
|
||||||
tcg_ctx->tb_jmp_insn_offset = tb->jmp_target_arg;
|
|
||||||
tcg_ctx->tb_jmp_target_addr = NULL;
|
|
||||||
} else {
|
|
||||||
tcg_ctx->tb_jmp_insn_offset = NULL;
|
|
||||||
tcg_ctx->tb_jmp_target_addr = tb->jmp_target_arg;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONFIG_PROFILER
|
#ifdef CONFIG_PROFILER
|
||||||
qatomic_set(&prof->tb_count, prof->tb_count + 1);
|
qatomic_set(&prof->tb_count, prof->tb_count + 1);
|
||||||
qatomic_set(&prof->interm_time,
|
qatomic_set(&prof->interm_time,
|
||||||
@ -1102,10 +1092,10 @@ TranslationBlock *libafl_gen_edge(CPUState *cpu, target_ulong src_block,
|
|||||||
tb->jmp_dest[1] = (uintptr_t)NULL;
|
tb->jmp_dest[1] = (uintptr_t)NULL;
|
||||||
|
|
||||||
/* init original jump addresses which have been set during tcg_gen_code() */
|
/* init original jump addresses which have been set during tcg_gen_code() */
|
||||||
if (tb->jmp_reset_offset[0] != TB_JMP_RESET_OFFSET_INVALID) {
|
if (tb->jmp_reset_offset[0] != TB_JMP_OFFSET_INVALID) {
|
||||||
tb_reset_jump(tb, 0);
|
tb_reset_jump(tb, 0);
|
||||||
}
|
}
|
||||||
if (tb->jmp_reset_offset[1] != TB_JMP_RESET_OFFSET_INVALID) {
|
if (tb->jmp_reset_offset[1] != TB_JMP_OFFSET_INVALID) {
|
||||||
tb_reset_jump(tb, 1);
|
tb_reset_jump(tb, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user