aboutsummaryrefslogtreecommitdiff
path: root/target/sh4
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2017-09-07 11:50:55 -0700
committerAurelien Jarno <aurelien@aurel32.net>2017-12-18 23:29:34 +0100
commit34cf5678088a4a1d624b39ace4f87e704c847d0e (patch)
tree282f2aa4d4f52a96425ed8ee8213ac3de47d6ad0 /target/sh4
parent4834871bc95b67343248100e2a75ae0d287bc08b (diff)
target/sh4: Do not singlestep after exceptions
If we've already raised an exception (and set NORETURN), do not emit unreachable code to raise a debug exception. Note that gen_goto_tb takes single-stepping into account. Signed-off-by: Richard Henderson <rth@twiddle.net> Message-Id: <20170907185057.23421-4-richard.henderson@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'target/sh4')
-rw-r--r--target/sh4/translate.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/target/sh4/translate.c b/target/sh4/translate.c
index efd1081c57..dd9aaa4e63 100644
--- a/target/sh4/translate.c
+++ b/target/sh4/translate.c
@@ -270,6 +270,7 @@ static void gen_jump(DisasContext * ctx)
} else {
tcg_gen_lookup_and_goto_ptr();
}
+ ctx->bstate = DISAS_NORETURN;
} else {
gen_goto_tb(ctx, 0, ctx->delayed_pc);
}
@@ -2341,24 +2342,23 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb)
ctx.envflags &= ~GUSA_MASK;
}
- if (cs->singlestep_enabled) {
+ switch (ctx.bstate) {
+ case DISAS_STOP:
gen_save_cpu_state(&ctx, true);
- gen_helper_debug(cpu_env);
- } else {
- switch (ctx.bstate) {
- case DISAS_STOP:
- gen_save_cpu_state(&ctx, true);
+ if (cs->singlestep_enabled) {
+ gen_helper_debug(cpu_env);
+ } else {
tcg_gen_exit_tb(0);
- break;
- case DISAS_NEXT:
- gen_save_cpu_state(&ctx, false);
- gen_goto_tb(&ctx, 0, ctx.pc);
- break;
- case DISAS_NORETURN:
- break;
- default:
- g_assert_not_reached();
- }
+ }
+ break;
+ case DISAS_NEXT:
+ gen_save_cpu_state(&ctx, false);
+ gen_goto_tb(&ctx, 0, ctx.pc);
+ break;
+ case DISAS_NORETURN:
+ break;
+ default:
+ g_assert_not_reached();
}
gen_tb_end(tb, num_insns);