Fix m68k single-stepping with remote gdb

-----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEEzS913cjjpNwuT1Fz8ww4vT8vvjwFAl4m7LgSHGxhdXJlbnRA
 dml2aWVyLmV1AAoJEPMMOL0/L748zqEP/3g8ATxwvhr0HVwzlntC9lSOBnEnHPru
 siOL69Nt9EBAm55d2WBCBsTps5Yke8KwqsSZkOmiXMGUOr0di3kfSaYRCiW1NvBY
 Kkp+rdX/zwHlLRh7iFRfKPCc3CAOU19neC5Z+MEBHB+e1OqwEJ8nXw4tzW7BOisQ
 uXuz0Z+dv1P0oW7if26sIJXQWJD17WaHUTKG78bNW/O4bae66GoAfUznZvmEWQSw
 2ikLq0563inqKzNk7xB0Zgt72DhQbTahrUGCwW7HNP9FfBP4szz1kXhXoLDCfZxC
 LfdEOH9ZttzvV6MwF0z9AyOiuTN7OGlVUNFZSgxyhec/3jzYtUnJwRcrUmyn5osK
 jQ964TysV76ZcE/vXQ9eDda/NyhHU1/+JpbQ1/oFlWteBKAkFlFALyaQVDySZvFy
 0yV0oIvKDwXw3NdbMPxhwhXpgrWdm/BJrMJkpqzgINdmM3RGzAT/gghOCbYqo1pF
 ZINuTUpZCxKUqYgB+2UMVgEzohdBSgVgrOL/749bVTYEdis/2k5eTEDr21R6Ajd4
 aoXZyxgukB1R8+2qr4e2EwwMBpNc1cFc+KnaD7ryvlKtwBCQ3TBMrlXG3z/IL/rI
 xS8dTC7Z7g6+lZ2j8EQDFUkyr5YNfd4e1fCjhw+mfJpPkObMODmn+06NNhZvoNSX
 yjwFJgtpKVgs
 =YUWB
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-5.0-pull-request' into staging

Fix m68k single-stepping with remote gdb

# gpg: Signature made Tue 21 Jan 2020 12:21:12 GMT
# gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg:                issuer "laurent@vivier.eu"
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full]
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [full]
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier/tags/m68k-for-5.0-pull-request:
  m68k: Fix regression causing Single-Step via GDB/RSP to not single step

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2020-01-21 12:23:58 +00:00
commit a4ccd092ac
1 changed files with 27 additions and 15 deletions

View File

@ -289,16 +289,21 @@ static void gen_jmp(DisasContext *s, TCGv dest)
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;
update_cc_op(s);
tcg_gen_movi_i32(QREG_PC, dest);
tmp = tcg_const_i32(nr);
gen_helper_raise_exception(cpu_env, 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;
}
@ -6198,29 +6203,36 @@ static void m68k_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
{
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) {
case DISAS_NORETURN:
break;
case DISAS_TOO_MANY:
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;
case DISAS_JUMP:
/* 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;
case DISAS_EXIT:
/*
* We updated CC_OP and PC in gen_exit_tb, but also modified
* 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;
default:
g_assert_not_reached();