From 4f268febb4996cc7cf0c9dfc0e7bbf83aa156553 Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Sun, 20 Dec 2015 12:23:36 +0800 Subject: [PATCH] mips: check for exit request after every hooked instruction. this fix issue #329 --- qemu/target-mips/translate.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/qemu/target-mips/translate.c b/qemu/target-mips/translate.c index e7b7e24c..8dd8b5f3 100644 --- a/qemu/target-mips/translate.c +++ b/qemu/target-mips/translate.c @@ -11349,11 +11349,8 @@ static int decode_mips16_opc (CPUMIPSState *env, DisasContext *ctx, bool *insn_n gen_uc_tracecode(tcg_ctx, 0xf8f8f8f8, trace->callback, env->uc, ctx->pc, trace->user_data); *insn_need_patch = true; } - // 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); } switch (op) { @@ -13951,11 +13948,8 @@ static int decode_micromips_opc (CPUMIPSState *env, DisasContext *ctx, bool *ins gen_uc_tracecode(tcg_ctx, 0xf8f8f8f8, trace->callback, env->uc, ctx->pc, trace->user_data); *insn_need_patch = true; } - // 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); } op = (ctx->opcode >> 10) & 0x3f; @@ -18532,11 +18526,8 @@ static void decode_opc (CPUMIPSState *env, DisasContext *ctx, bool *insn_need_pa gen_uc_tracecode(tcg_ctx, 0xf8f8f8f8, trace->callback, env->uc, ctx->pc, trace->user_data); *insn_need_patch = true; } - // 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); } /* Handle blikely not taken case */