From 9f62c710949284211a43c7b47111eb25317c0a9f Mon Sep 17 00:00:00 2001 From: lazymio Date: Sun, 27 Feb 2022 15:30:27 +0100 Subject: [PATCH] Sync PC for SYS instruction hook --- qemu/target/arm/translate-a64.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/qemu/target/arm/translate-a64.c b/qemu/target/arm/translate-a64.c index 62f462ec..2b5bdd43 100644 --- a/qemu/target/arm/translate-a64.c +++ b/qemu/target/arm/translate-a64.c @@ -1761,6 +1761,9 @@ static TCGLabel *gen_hook_sys(DisasContext *s, uint32_t insn, struct hook *hk) tcg_insn = tcg_const_i32(tcg_ctx, insn); tcg_hk = tcg_const_ptr(tcg_ctx, (void*)hk); + // Sync pc in advance. + gen_a64_set_pc_im(tcg_ctx, s->pc_curr); + // Only one hook per instruction for SYS/SYSL/MRS/MSR is allowed. // This is intended and may be extended if it's really necessary. gen_helper_uc_hooksys64(tcg_ctx, tcg_skip, tcg_ctx->cpu_env, tcg_insn, tcg_hk);