sparc, arm, m68k: check for exit request after every hooked instruction

This commit is contained in:
Nguyen Anh Quynh 2015-12-20 12:28:15 +08:00
parent 4f268febb4
commit b72671c6d5
4 changed files with 10 additions and 20 deletions

View File

@ -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); struct hook_struct *trace = hook_find(s->uc, UC_HOOK_CODE, s->pc - 4);
if (trace) if (trace)
gen_uc_tracecode(tcg_ctx, 4, trace->callback, env->uc, s->pc - 4, trace->user_data); 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 // the callback might want to stop emulation immediately
// we need to exit immediately check_exit_request(tcg_ctx);
if (env->uc->emu_count > 0) {
check_exit_request(tcg_ctx);
}
} }
s->fp_access_checked = false; s->fp_access_checked = false;

View File

@ -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); struct hook_struct *trace = hook_find(s->uc, UC_HOOK_CODE, s->pc - 4);
if (trace) if (trace)
gen_uc_tracecode(tcg_ctx, 4, trace->callback, s->uc, s->pc - 4, trace->user_data); 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 // the callback might want to stop emulation immediately
// we need to exit immediately check_exit_request(tcg_ctx);
if (s->uc->emu_count > 0) {
check_exit_request(tcg_ctx);
}
} }
cond = insn >> 28; cond = insn >> 28;

View File

@ -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); struct hook_struct *trace = hook_find(env->uc, UC_HOOK_CODE, s->pc);
if (trace) if (trace)
gen_uc_tracecode(tcg_ctx, 2, trace->callback, env->uc, s->pc, trace->user_data); 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 // the callback might want to stop emulation immediately
if (env->uc->emu_count > 0) { check_exit_request(tcg_ctx);
check_exit_request(tcg_ctx);
}
} }
insn = cpu_lduw_code(env, s->pc); insn = cpu_lduw_code(env, s->pc);

View File

@ -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); struct hook_struct *trace = hook_find(dc->uc, UC_HOOK_CODE, dc->pc);
if (trace) if (trace)
gen_uc_tracecode(tcg_ctx, 4, trace->callback, dc->uc, dc->pc, trace->user_data); 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 // the callback might want to stop emulation immediately
if (dc->uc->emu_count > 0) { check_exit_request(tcg_ctx);
check_exit_request(tcg_ctx);
}
} }
opc = GET_FIELD(insn, 0, 1); opc = GET_FIELD(insn, 0, 1);