m68k: Fix regression causing Single-Step via GDB/RSP to not single step

A regression that was introduced, with the refactor to TranslatorOps,
drops two lines that update the PC when single-stepping is being performed.

Fixes: 11ab74b01e ("target/m68k: Convert to TranslatorOps")
Reported-by: Lucien Murray-Pitts <lucienmp_antispam@yahoo.com>
Suggested-by: Lucien Murray-Pitts <lucienmp_antispam@yahoo.com>
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200116165454.2076265-1-laurent@vivier.eu>
This commit is contained in:
Laurent Vivier 2020-01-16 17:54:54 +01:00
parent d83bbedab5
commit 322f244aaa

View file

@ -289,16 +289,21 @@ static void gen_jmp(DisasContext *s, TCGv dest)
s->base.is_jmp = DISAS_JUMP; s->base.is_jmp = DISAS_JUMP;
} }
static void gen_exception(DisasContext *s, uint32_t dest, int nr) static void gen_raise_exception(int nr)
{ {
TCGv_i32 tmp; TCGv_i32 tmp;
update_cc_op(s);
tcg_gen_movi_i32(QREG_PC, dest);
tmp = tcg_const_i32(nr); tmp = tcg_const_i32(nr);
gen_helper_raise_exception(cpu_env, tmp); gen_helper_raise_exception(cpu_env, tmp);
tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp);
}
static void gen_exception(DisasContext *s, uint32_t dest, int nr)
{
update_cc_op(s);
tcg_gen_movi_i32(QREG_PC, dest);
gen_raise_exception(nr);
s->base.is_jmp = DISAS_NORETURN; s->base.is_jmp = DISAS_NORETURN;
} }
@ -6198,29 +6203,36 @@ static void m68k_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
{ {
DisasContext *dc = container_of(dcbase, DisasContext, base); DisasContext *dc = container_of(dcbase, DisasContext, base);
if (dc->base.is_jmp == DISAS_NORETURN) {
return;
}
if (dc->base.singlestep_enabled) {
gen_helper_raise_exception(cpu_env, tcg_const_i32(EXCP_DEBUG));
return;
}
switch (dc->base.is_jmp) { switch (dc->base.is_jmp) {
case DISAS_NORETURN:
break;
case DISAS_TOO_MANY: case DISAS_TOO_MANY:
update_cc_op(dc); update_cc_op(dc);
gen_jmp_tb(dc, 0, dc->pc); if (dc->base.singlestep_enabled) {
tcg_gen_movi_i32(QREG_PC, dc->pc);
gen_raise_exception(EXCP_DEBUG);
} else {
gen_jmp_tb(dc, 0, dc->pc);
}
break; break;
case DISAS_JUMP: case DISAS_JUMP:
/* We updated CC_OP and PC in gen_jmp/gen_jmp_im. */ /* We updated CC_OP and PC in gen_jmp/gen_jmp_im. */
tcg_gen_lookup_and_goto_ptr(); if (dc->base.singlestep_enabled) {
gen_raise_exception(EXCP_DEBUG);
} else {
tcg_gen_lookup_and_goto_ptr();
}
break; break;
case DISAS_EXIT: case DISAS_EXIT:
/* /*
* We updated CC_OP and PC in gen_exit_tb, but also modified * We updated CC_OP and PC in gen_exit_tb, but also modified
* other state that may require returning to the main loop. * other state that may require returning to the main loop.
*/ */
tcg_gen_exit_tb(NULL, 0); if (dc->base.singlestep_enabled) {
gen_raise_exception(EXCP_DEBUG);
} else {
tcg_gen_exit_tb(NULL, 0);
}
break; break;
default: default:
g_assert_not_reached(); g_assert_not_reached();