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>
This commit is contained in:
parent
4834871bc9
commit
34cf567808
|
@ -270,6 +270,7 @@ static void gen_jump(DisasContext * ctx)
|
||||||
} else {
|
} else {
|
||||||
tcg_gen_lookup_and_goto_ptr();
|
tcg_gen_lookup_and_goto_ptr();
|
||||||
}
|
}
|
||||||
|
ctx->bstate = DISAS_NORETURN;
|
||||||
} else {
|
} else {
|
||||||
gen_goto_tb(ctx, 0, ctx->delayed_pc);
|
gen_goto_tb(ctx, 0, ctx->delayed_pc);
|
||||||
}
|
}
|
||||||
|
@ -2341,14 +2342,14 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb)
|
||||||
ctx.envflags &= ~GUSA_MASK;
|
ctx.envflags &= ~GUSA_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cs->singlestep_enabled) {
|
|
||||||
gen_save_cpu_state(&ctx, true);
|
|
||||||
gen_helper_debug(cpu_env);
|
|
||||||
} else {
|
|
||||||
switch (ctx.bstate) {
|
switch (ctx.bstate) {
|
||||||
case DISAS_STOP:
|
case DISAS_STOP:
|
||||||
gen_save_cpu_state(&ctx, true);
|
gen_save_cpu_state(&ctx, true);
|
||||||
|
if (cs->singlestep_enabled) {
|
||||||
|
gen_helper_debug(cpu_env);
|
||||||
|
} else {
|
||||||
tcg_gen_exit_tb(0);
|
tcg_gen_exit_tb(0);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case DISAS_NEXT:
|
case DISAS_NEXT:
|
||||||
gen_save_cpu_state(&ctx, false);
|
gen_save_cpu_state(&ctx, false);
|
||||||
|
@ -2359,7 +2360,6 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb)
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached();
|
g_assert_not_reached();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
gen_tb_end(tb, num_insns);
|
gen_tb_end(tb, num_insns);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue