aboutsummaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2023-10-03 15:26:06 -0700
committerRichard Henderson <richard.henderson@linaro.org>2024-04-24 15:46:00 -0700
commit0815c228bd1e0c24ac064ce299807b32f8e05d83 (patch)
treef8d2b128bbca89aa57324815680d576aab6c6db8 /target
parentf161e723fdfddfc820c7f19eb6ac76ac6ba6d2a8 (diff)
target/m68k: Support semihosting on non-ColdFire targets
According to the m68k semihosting spec: "The instruction used to trigger a semihosting request depends on the m68k processor variant. On ColdFire, "halt" is used; on other processors (which don't implement "halt"), "bkpt #0" may be used." Add support for non-CodeFire processors by matching BKPT #0 instructions. Signed-off-by: Keith Packard <keithp@keithp.com> [rth: Use semihosting_test()] Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'target')
-rw-r--r--target/m68k/translate.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/target/m68k/translate.c b/target/m68k/translate.c
index 647bd9d9be..169927552a 100644
--- a/target/m68k/translate.c
+++ b/target/m68k/translate.c
@@ -2646,6 +2646,11 @@ DISAS_INSN(bkpt)
#if defined(CONFIG_USER_ONLY)
gen_exception(s, s->base.pc_next, EXCP_DEBUG);
#else
+ /* BKPT #0 is the alternate semihosting instruction. */
+ if ((insn & 7) == 0 && semihosting_test(s)) {
+ gen_exception(s, s->pc, EXCP_SEMIHOSTING);
+ return;
+ }
gen_exception(s, s->base.pc_next, EXCP_ILLEGAL);
#endif
}