From: "Hervé Poussineau" <hpoussin@reactos.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, "Hervé Poussineau" <hpoussin@reactos.org>
Subject: [Qemu-devel] [PATCH 2/4] lsi: do not exit QEMU if reading invalid register
Date: Thu, 18 Aug 2016 09:31:27 +0200 [thread overview]
Message-ID: <1471505489-1221-3-git-send-email-hpoussin@reactos.org> (raw)
In-Reply-To: <1471505489-1221-1-git-send-email-hpoussin@reactos.org>
When guest accesses invalid register, return 0xff instead of exiting.
Also add a log when reading or writing invalid registers.
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
hw/scsi/lsi53c895a.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index 07dc73a..9d2e3eb 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -19,6 +19,7 @@
#include "hw/pci/pci.h"
#include "hw/scsi/scsi.h"
#include "sysemu/dma.h"
+#include "qemu/log.h"
//#define DEBUG_LSI
//#define DEBUG_LSI_REG
@@ -34,7 +35,6 @@ do { fprintf(stderr, "lsi_scsi: error: " fmt , ## __VA_ARGS__); exit(1);} while
do { fprintf(stderr, "lsi_scsi: error: " fmt , ## __VA_ARGS__);} while (0)
#endif
-#ifdef DEBUG_LSI_REG
static const char *names[] = {
"SCNTL0", "SCNTL1", "SCNTL2", "SCNTL3", "SCID", "SXFER", "SDID", "GPREG",
"SFBR", "SOCL", "SSID", "SBCL", "DSTAT", "SSTAT0", "SSTAT1", "SSTAT2",
@@ -49,7 +49,6 @@ static const char *names[] = {
"SIDL", "0x51", "0x52", "0x53", "SODL", "0x55", "0x56", "0x57",
"SBDL", "0x59", "0x5a", "0x5b", "SCRATCHB0", "SCRATCHB1", "SCRATCHB2", "SCRATCHB3",
};
-#endif
#define LSI_MAX_DEVS 7
@@ -1715,8 +1714,14 @@ static uint8_t lsi_reg_readb(LSIState *s, int offset)
break;
}
default:
- BADF("readb 0x%x\n", offset);
- exit(1);
+ {
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "lsi_scsi: invalid read from reg %s %x\n",
+ offset < ARRAY_SIZE(names) ? names[offset] : "???",
+ offset);
+ ret = 0xff;
+ break;
+ }
}
#undef CASE_GET_REG24
#undef CASE_GET_REG32
@@ -1959,7 +1964,10 @@ static void lsi_reg_writeb(LSIState *s, int offset, uint8_t val)
shift = (offset & 3) * 8;
s->scratch[n] = deposit32(s->scratch[n], shift, 8, val);
} else {
- BADF("Unhandled writeb 0x%x = 0x%x\n", offset, val);
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "lsi_scsi: invalid write to reg %s %x (0x%02x)\n",
+ offset < ARRAY_SIZE(names) ? names[offset] : "???",
+ offset, val);
}
}
#undef CASE_SET_REG24
--
2.1.4
next prev parent reply other threads:[~2016-08-18 7:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-18 7:31 [Qemu-devel] [PATCH 0/4] lsi: misc fixes Hervé Poussineau
2016-08-18 7:31 ` [Qemu-devel] [PATCH 1/4] lsi: print register names in debug prints Hervé Poussineau
2016-08-18 7:31 ` Hervé Poussineau [this message]
2016-08-18 7:31 ` [Qemu-devel] [PATCH 3/4] lsi: implement I/O memory space for Memory Move instructions Hervé Poussineau
2016-08-18 7:31 ` [Qemu-devel] [PATCH 4/4] lsi: never set DMA FIFO Empty (DFE) bit in DSTAT register Hervé Poussineau
2016-08-18 7:41 ` [Qemu-devel] [PATCH 0/4] lsi: misc fixes no-reply
2016-08-18 8:47 ` Paolo Bonzini
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=1471505489-1221-3-git-send-email-hpoussin@reactos.org \
--to=hpoussin@reactos.org \
--cc=pbonzini@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.