[PATCH 38/43] target/m68k: Enable semihosting for non-coldfire

Richard Henderson posted 43 patches 3 years, 9 months ago
Maintainers: Laurent Vivier <laurent@vivier.eu>, "Alex Bennée" <alex.bennee@linaro.org>, "Philippe Mathieu-Daudé" <f4bug@amsat.org>, Peter Maydell <peter.maydell@linaro.org>, Aurelien Jarno <aurelien@aurel32.net>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>, Chris Wulff <crwulff@gmail.com>, Marek Vasut <marex@denx.de>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Bin Meng <bin.meng@windriver.com>
There is a newer version of this series
[PATCH 38/43] target/m68k: Enable semihosting for non-coldfire
Posted by Richard Henderson 3 years, 9 months ago
The libgloss m68k-semi.txt spec says that bkpt #0 may be
used when the halt insn is not available.  While halt is
available for 68060, continue to support bkpt #0 for all
m68k processors.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/m68k/translate.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/target/m68k/translate.c b/target/m68k/translate.c
index b7adc8f53d..51c546f26f 100644
--- a/target/m68k/translate.c
+++ b/target/m68k/translate.c
@@ -2775,6 +2775,15 @@ DISAS_INSN(swap)
 
 DISAS_INSN(bkpt)
 {
+#ifndef CONFIG_USER_ONLY
+    /* The non-ColdFire semihosting insn is bkpt #0. */
+    if (!m68k_feature(s->env, M68K_FEATURE_CF_ISA_A)
+        && !IS_USER(s)
+        && (insn & 7) == 0
+        && maybe_semihosting(s)) {
+        return;
+    }
+#endif
     gen_exception(s, s->base.pc_next, EXCP_DEBUG);
 }
 
-- 
2.34.1