From: Laurent Vivier <laurent@vivier.eu>
To: qemu-devel@nongnu.org
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
Laurent Vivier <laurent@vivier.eu>
Subject: [PULL 2/9] target/m68k: don't set SSW ATC bit for physical bus errors
Date: Thu, 11 Mar 2021 22:09:27 +0100 [thread overview]
Message-ID: <20210311210934.1935587-3-laurent@vivier.eu> (raw)
In-Reply-To: <20210311210934.1935587-1-laurent@vivier.eu>
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
If a NuBus slot doesn't contain a card, the Quadra hardware generates a physical
bus error if the CPU attempts to access the slot address space. Both Linux and
MacOS use a separate bus error handler during NuBus accesses in order to detect
and recover when addressing empty slots.
According to the MC68040 users manual the ATC bit of the SSW is used to
distinguish between ATC faults and physical bus errors. MacOS specifically checks
the stack frame generated by a NuBus error and panics if the SSW ATC bit is set.
Update m68k_cpu_transaction_failed() so that the SSW ATC bit is not set if the
memory API returns MEMTX_DECODE_ERROR which will be used to indicate that an
access to an empty NuBus slot occurred.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20210308121155.2476-2-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
target/m68k/op_helper.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c
index 730cdf774445..5f981e5bf628 100644
--- a/target/m68k/op_helper.c
+++ b/target/m68k/op_helper.c
@@ -468,7 +468,17 @@ void m68k_cpu_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr,
if (m68k_feature(env, M68K_FEATURE_M68040)) {
env->mmu.mmusr = 0;
- env->mmu.ssw |= M68K_ATC_040;
+
+ /*
+ * According to the MC68040 users manual the ATC bit of the SSW is
+ * used to distinguish between ATC faults and physical bus errors.
+ * In the case of a bus error e.g. during nubus read from an empty
+ * slot this bit should not be set
+ */
+ if (response != MEMTX_DECODE_ERROR) {
+ env->mmu.ssw |= M68K_ATC_040;
+ }
+
/* FIXME: manage MMU table access error */
env->mmu.ssw &= ~M68K_TM_040;
if (env->sr & SR_S) { /* SUPERVISOR */
--
2.29.2
next prev parent reply other threads:[~2021-03-11 21:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-11 21:09 [PULL 0/9] M68k for 6.0 patches Laurent Vivier
2021-03-11 21:09 ` [PULL 1/9] target/m68k: implement rtr instruction Laurent Vivier
2021-03-11 21:09 ` Laurent Vivier [this message]
2021-03-11 21:09 ` [PULL 3/9] target/m68k: reformat m68k_features enum Laurent Vivier
2021-03-11 21:09 ` [PULL 4/9] target/m68k: add M68K_FEATURE_UNALIGNED_DATA feature Laurent Vivier
2021-03-11 21:09 ` [PULL 5/9] char: add goldfish-tty Laurent Vivier
2021-03-11 21:57 ` Peter Maydell
2021-03-11 22:04 ` Laurent Vivier
2021-03-11 22:34 ` Philippe Mathieu-Daudé
2021-03-12 8:13 ` Laurent Vivier
2021-03-15 11:35 ` Daniel P. Berrangé
2021-03-15 14:37 ` Laurent Vivier
2021-03-11 21:09 ` [PULL 6/9] intc: add goldfish-pic Laurent Vivier
2021-03-11 21:09 ` [PULL 7/9] m68k: add an interrupt controller Laurent Vivier
2021-03-11 21:09 ` [PULL 8/9] m68k: add a system controller Laurent Vivier
2021-03-11 21:09 ` [PULL 9/9] m68k: add Virtual M68k Machine Laurent Vivier
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=20210311210934.1935587-3-laurent@vivier.eu \
--to=laurent@vivier.eu \
--cc=mark.cave-ayland@ilande.co.uk \
--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).