mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-07-05 23:00:33 +00:00
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: 11ab74b01e0a ("target/m68k: Convert to TranslatorOps") Backports commit 322f244aaa80a5208090d41481c1c09c6face66b from qemu
This commit is contained in:
parent
dc9733e555
commit
066f619b02
|
@ -288,18 +288,25 @@ 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(DisasContext *s, int nr)
|
||||||
{
|
{
|
||||||
TCGContext *tcg_ctx = s->uc->tcg_ctx;
|
TCGContext *tcg_ctx = s->uc->tcg_ctx;
|
||||||
TCGv_i32 tmp;
|
TCGv_i32 tmp;
|
||||||
|
|
||||||
update_cc_op(s);
|
|
||||||
tcg_gen_movi_i32(tcg_ctx, tcg_ctx->QREG_PC, dest);
|
|
||||||
|
|
||||||
tmp = tcg_const_i32(tcg_ctx, nr);
|
tmp = tcg_const_i32(tcg_ctx, nr);
|
||||||
|
|
||||||
gen_helper_raise_exception(tcg_ctx, tcg_ctx->cpu_env, tmp);
|
gen_helper_raise_exception(tcg_ctx, tcg_ctx->cpu_env, tmp);
|
||||||
tcg_temp_free_i32(tcg_ctx, tmp);
|
tcg_temp_free_i32(tcg_ctx, tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gen_exception(DisasContext *s, uint32_t dest, int nr)
|
||||||
|
{
|
||||||
|
TCGContext *tcg_ctx = s->uc->tcg_ctx;
|
||||||
|
|
||||||
|
update_cc_op(s);
|
||||||
|
tcg_gen_movi_i32(tcg_ctx, tcg_ctx->QREG_PC, dest);
|
||||||
|
|
||||||
|
gen_raise_exception(s, nr);
|
||||||
|
|
||||||
s->base.is_jmp = DISAS_NORETURN;
|
s->base.is_jmp = DISAS_NORETURN;
|
||||||
}
|
}
|
||||||
|
@ -6461,29 +6468,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);
|
||||||
TCGContext *tcg_ctx = dc->uc->tcg_ctx;
|
TCGContext *tcg_ctx = dc->uc->tcg_ctx;
|
||||||
|
|
||||||
if (dc->base.is_jmp == DISAS_NORETURN) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (dc->base.singlestep_enabled) {
|
|
||||||
gen_helper_raise_exception(tcg_ctx, tcg_ctx->cpu_env, tcg_const_i32(tcg_ctx, 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(tcg_ctx, tcg_ctx->QREG_PC, dc->pc);
|
||||||
|
gen_raise_exception(dc, 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(tcg_ctx);
|
if (dc->base.singlestep_enabled) {
|
||||||
|
gen_raise_exception(dc, EXCP_DEBUG);
|
||||||
|
} else {
|
||||||
|
tcg_gen_lookup_and_goto_ptr(tcg_ctx);
|
||||||
|
}
|
||||||
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(tcg_ctx, NULL, 0);
|
if (dc->base.singlestep_enabled) {
|
||||||
|
gen_raise_exception(dc, EXCP_DEBUG);
|
||||||
|
} else {
|
||||||
|
tcg_gen_exit_tb(tcg_ctx, NULL, 0);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached();
|
g_assert_not_reached();
|
||||||
|
|
Loading…
Reference in a new issue