No longer used hacked liveness_pass_1
This hack was introduced in issue#287 which later becomes endless maintainance pain. ===== Our previous check_exit_request use `brcond` in the middle of a TranslationBlock which breaks the assumptions and thus a hack to liveness_pass_1 is used for _all_ brcond instructions which causes issues for MIPS and many other scenarios. ===== This patch also resolves PC not sync-ed when no memory hooks are installed, finally. Now Unicorn will always have correct PC no matter what happens.
This commit is contained in:
@@ -1575,7 +1575,7 @@ load_helper(CPUArchState *env, target_ulong addr, TCGMemOpIdx oi,
|
||||
// because qemu might generate tcg code like:
|
||||
// qemu_ld_i64 x0,x1,leq,8 sync: 0 dead: 0 1
|
||||
// where we don't have a change to recover x0 value
|
||||
cpu_loop_exit(uc->cpu);
|
||||
cpu_loop_exit_restore(uc->cpu, retaddr);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1586,7 +1586,7 @@ load_helper(CPUArchState *env, target_ulong addr, TCGMemOpIdx oi,
|
||||
if (uc->nested_level > 0 && !uc->cpu->stopped) {
|
||||
cpu_exit(uc->cpu);
|
||||
// See comments above
|
||||
cpu_loop_exit(uc->cpu);
|
||||
cpu_loop_exit_restore(uc->cpu, retaddr);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1660,7 +1660,7 @@ load_helper(CPUArchState *env, target_ulong addr, TCGMemOpIdx oi,
|
||||
if (uc->nested_level > 0 && !uc->cpu->stopped) {
|
||||
cpu_exit(uc->cpu);
|
||||
// See comments above
|
||||
cpu_loop_exit(uc->cpu);
|
||||
cpu_loop_exit_restore(uc->cpu, retaddr);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1694,7 +1694,7 @@ load_helper(CPUArchState *env, target_ulong addr, TCGMemOpIdx oi,
|
||||
if (uc->nested_level > 0 && !uc->cpu->stopped) {
|
||||
cpu_exit(uc->cpu);
|
||||
// See comments above
|
||||
cpu_loop_exit(uc->cpu);
|
||||
cpu_loop_exit_restore(uc->cpu, retaddr);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -164,3 +164,25 @@ void HELPER(exit_atomic)(CPUArchState *env)
|
||||
{
|
||||
cpu_loop_exit_atomic(env_cpu(env), GETPC());
|
||||
}
|
||||
|
||||
void HELPER(check_exit_request)(void *p, uint32_t in_delay_slot) {
|
||||
uc_engine *uc = p;
|
||||
|
||||
if (cpu_loop_exit_requested(uc->cpu) && !in_delay_slot) {
|
||||
// There are stil something we have to before exiting to be compatible with previous behaviors
|
||||
|
||||
// from cpu_tb_exec
|
||||
if (uc->nested_level == 1) {
|
||||
// Only unlock (allow writing to JIT area) if we are the outmost uc_emu_start
|
||||
tb_exec_unlock(uc);
|
||||
}
|
||||
uc->cpu->tcg_exit_req = 0;
|
||||
|
||||
if (uc->skip_sync_pc_on_exit) {
|
||||
cpu_loop_exit(uc->cpu);
|
||||
} else {
|
||||
uc->skip_sync_pc_on_exit = false;
|
||||
cpu_loop_exit_restore(uc->cpu, GETPC());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -259,3 +259,5 @@ DEF_HELPER_FLAGS_4(gvec_leu32, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
|
||||
DEF_HELPER_FLAGS_4(gvec_leu64, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
|
||||
|
||||
DEF_HELPER_FLAGS_5(gvec_bitsel, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
|
||||
|
||||
DEF_HELPER_2(check_exit_request, void, ptr, i32)
|
||||
Reference in New Issue
Block a user