From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: keithp@keithp.com, laurent@vivier.eu
Subject: [PATCH v2 2/2] target/m68k: Support semihosting on non-ColdFire targets
Date: Tue, 3 Oct 2023 15:36:24 -0700 [thread overview]
Message-ID: <20231003223624.1753000-3-richard.henderson@linaro.org> (raw)
In-Reply-To: <20231003223624.1753000-1-richard.henderson@linaro.org>
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>
---
target/m68k/translate.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/target/m68k/translate.c b/target/m68k/translate.c
index e07b0b659d..54c3ff1218 100644
--- a/target/m68k/translate.c
+++ b/target/m68k/translate.c
@@ -2663,6 +2663,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
}
--
2.34.1
prev parent reply other threads:[~2023-10-03 22:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-03 22:36 [PATCH v2 0/2] target/m68k: Support semihosting on non-ColdFire targets Richard Henderson
2023-10-03 22:36 ` [PATCH v2 1/2] target/m68k: Perform the semihosting test during translate Richard Henderson
2023-10-03 22:36 ` Richard Henderson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231003223624.1753000-3-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=keithp@keithp.com \
--cc=laurent@vivier.eu \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).