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:
mio
2025-04-12 21:38:14 +08:00
parent e89eb87d04
commit 7f48b1dd4a
28 changed files with 80 additions and 63 deletions

View File

@@ -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());
}
}
}