diff --git a/qemu/target-arm/translate-a64.c b/qemu/target-arm/translate-a64.c index 8e267f98..c76de8e0 100644 --- a/qemu/target-arm/translate-a64.c +++ b/qemu/target-arm/translate-a64.c @@ -10988,11 +10988,8 @@ static void disas_a64_insn(CPUARMState *env, DisasContext *s) struct hook_struct *trace = hook_find(s->uc, UC_HOOK_CODE, s->pc - 4); if (trace) gen_uc_tracecode(tcg_ctx, 4, trace->callback, env->uc, s->pc - 4, trace->user_data); - // if requested to emulate only some instructions, check if - // we need to exit immediately - if (env->uc->emu_count > 0) { - check_exit_request(tcg_ctx); - } + // the callback might want to stop emulation immediately + check_exit_request(tcg_ctx); } s->fp_access_checked = false; diff --git a/qemu/target-arm/translate.c b/qemu/target-arm/translate.c index 83f8ec02..3560e6ed 100644 --- a/qemu/target-arm/translate.c +++ b/qemu/target-arm/translate.c @@ -7691,11 +7691,8 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) // qq struct hook_struct *trace = hook_find(s->uc, UC_HOOK_CODE, s->pc - 4); if (trace) gen_uc_tracecode(tcg_ctx, 4, trace->callback, s->uc, s->pc - 4, trace->user_data); - // if requested to emulate only some instructions, check if - // we need to exit immediately - if (s->uc->emu_count > 0) { - check_exit_request(tcg_ctx); - } + // the callback might want to stop emulation immediately + check_exit_request(tcg_ctx); } cond = insn >> 28; diff --git a/qemu/target-m68k/translate.c b/qemu/target-m68k/translate.c index 109c7f1f..8c2951d9 100644 --- a/qemu/target-m68k/translate.c +++ b/qemu/target-m68k/translate.c @@ -3047,11 +3047,9 @@ static void disas_m68k_insn(CPUM68KState * env, DisasContext *s) struct hook_struct *trace = hook_find(env->uc, UC_HOOK_CODE, s->pc); if (trace) gen_uc_tracecode(tcg_ctx, 2, trace->callback, env->uc, s->pc, trace->user_data); - // if requested to emulate only some instructions, check if - // we need to exit immediately - if (env->uc->emu_count > 0) { - check_exit_request(tcg_ctx); - } + + // the callback might want to stop emulation immediately + check_exit_request(tcg_ctx); } insn = cpu_lduw_code(env, s->pc); diff --git a/qemu/target-sparc/translate.c b/qemu/target-sparc/translate.c index f076633e..fc71e88b 100644 --- a/qemu/target-sparc/translate.c +++ b/qemu/target-sparc/translate.c @@ -2641,11 +2641,9 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn, bool hook_ins struct hook_struct *trace = hook_find(dc->uc, UC_HOOK_CODE, dc->pc); if (trace) gen_uc_tracecode(tcg_ctx, 4, trace->callback, dc->uc, dc->pc, trace->user_data); - // if requested to emulate only some instructions, check if - // we need to exit immediately - if (dc->uc->emu_count > 0) { - check_exit_request(tcg_ctx); - } + + // the callback might want to stop emulation immediately + check_exit_request(tcg_ctx); } opc = GET_FIELD(insn, 0, 1);