[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 19/58] lsi: do not exit QEMU if reading invalid regis
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 19/58] lsi: do not exit QEMU if reading invalid register |
Date: |
Tue, 13 Sep 2016 19:15:50 +0200 |
From: Hervé Poussineau <address@hidden>
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 <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Hervé Poussineau <address@hidden>
---
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
--
1.8.3.1
- [Qemu-devel] [PULL 12/58] tcg: rename tb_find_physical(), (continued)
- [Qemu-devel] [PULL 12/58] tcg: rename tb_find_physical(), Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 06/58] tcg: Prepare safe access to tb_flushed out of tb_lock, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 10/58] tcg: Avoid bouncing tb_lock between tb_gen_code() and tb_add_jump(), Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 13/58] rules.mak: Don't extract libs from .mo-libs in link command, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 14/58] timer: update comments, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 15/58] cpus: rename local variable to meaningful one, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 21/58] lsi: never set DMA FIFO Empty (DFE) bit in DSTAT register, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 23/58] scsi-disk: change disk serial length from 20 to 36, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 24/58] vmw_pvscsi: check page count while initialising descriptor rings, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 16/58] cpus: update comments, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 19/58] lsi: do not exit QEMU if reading invalid register,
Paolo Bonzini <=
- [Qemu-devel] [PULL 20/58] lsi: implement I/O memory space for Memory Move instructions, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 17/58] help: Update help to remove misleading display information, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 18/58] lsi: print register names in debug prints, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 22/58] MAINTAINERS: add myself as stubs maintainers, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 25/58] scsi: mptconfig: fix an assert expression, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 26/58] scsi: mptconfig: fix misuse of MPTSAS_CONFIG_PACK, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 27/58] vmxcap: Show raw MSR value, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 28/58] vmxcap: Add TSC scaling bit, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 30/58] chardev: Add 'help' option to print all available chardev backend types, Paolo Bonzini, 2016/09/13
- [Qemu-devel] [PULL 29/58] doc/rcu: fix typo, Paolo Bonzini, 2016/09/13