fix load_helper & store_helper for PC sync

This commit is contained in:
mio
2025-04-12 23:37:20 +08:00
parent 2d04b2a71d
commit b999f507b9

View File

@@ -1521,7 +1521,7 @@ load_helper(CPUArchState *env, target_ulong addr, TCGMemOpIdx oi,
continue;
if (!HOOK_BOUND_CHECK(hook, paddr))
continue;
if (!synced && retaddr) {
if (!synced && !uc->skip_sync_pc_on_exit && retaddr) {
cpu_restore_state(uc->cpu, retaddr, false);
synced = true;
}
@@ -1542,7 +1542,7 @@ load_helper(CPUArchState *env, target_ulong addr, TCGMemOpIdx oi,
continue;
if (!HOOK_BOUND_CHECK(hook, paddr))
continue;
if (!synced && retaddr) {
if (!synced &&!uc->skip_sync_pc_on_exit && retaddr) {
cpu_restore_state(uc->cpu, retaddr, false);
synced = true;
}
@@ -1610,7 +1610,7 @@ load_helper(CPUArchState *env, target_ulong addr, TCGMemOpIdx oi,
continue;
if (!HOOK_BOUND_CHECK(hook, paddr))
continue;
if (!synced && retaddr) {
if (!synced && !uc->skip_sync_pc_on_exit && retaddr) {
cpu_restore_state(uc->cpu, retaddr, false);
synced = true;
}
@@ -1642,7 +1642,7 @@ load_helper(CPUArchState *env, target_ulong addr, TCGMemOpIdx oi,
continue;
if (!HOOK_BOUND_CHECK(hook, paddr))
continue;
if (!synced && retaddr) {
if (!synced && !uc->skip_sync_pc_on_exit && retaddr) {
cpu_restore_state(uc->cpu, retaddr, false);
synced = true;
}
@@ -1692,7 +1692,7 @@ load_helper(CPUArchState *env, target_ulong addr, TCGMemOpIdx oi,
continue;
if (!HOOK_BOUND_CHECK(hook, paddr))
continue;
if (!synced && retaddr) {
if (!synced && !uc->skip_sync_pc_on_exit && retaddr) {
cpu_restore_state(uc->cpu, retaddr, false);
synced = true;
}
@@ -1806,6 +1806,10 @@ _out:
continue;
if (!HOOK_BOUND_CHECK(hook, paddr))
continue;
if (!synced && !uc->skip_sync_pc_on_exit && retaddr) {
cpu_restore_state(uc->cpu, retaddr, false);
synced = true;
}
JIT_CALLBACK_GUARD(((uc_cb_hookmem_t)hook->callback)(env->uc, UC_MEM_READ_AFTER, paddr, size, res, hook->user_data));
// the last callback may already asked to stop emulation
if (uc->stop_request)
@@ -2150,7 +2154,7 @@ store_helper(CPUArchState *env, target_ulong addr, uint64_t val,
continue;
if (!HOOK_BOUND_CHECK(hook, paddr))
continue;
if (!synced && retaddr) {
if (!synced && !uc->skip_sync_pc_on_exit && retaddr) {
cpu_restore_state(uc->cpu, retaddr, false);
synced = true;
}
@@ -2169,7 +2173,7 @@ store_helper(CPUArchState *env, target_ulong addr, uint64_t val,
continue;
if (!HOOK_BOUND_CHECK(hook, paddr))
continue;
if (!synced && retaddr) {
if (!synced && !uc->skip_sync_pc_on_exit && retaddr) {
cpu_restore_state(uc->cpu, retaddr, false);
synced = true;
}
@@ -2222,7 +2226,7 @@ store_helper(CPUArchState *env, target_ulong addr, uint64_t val,
continue;
if (!HOOK_BOUND_CHECK(hook, paddr))
continue;
if (!synced && retaddr) {
if (!synced && !uc->skip_sync_pc_on_exit && retaddr) {
cpu_restore_state(uc->cpu, retaddr, false);
synced = true;
}