提交 85a20bc4 编写于 作者: H Hervé Poussineau 提交者: Paolo Bonzini

lsi: do not exit QEMU if reading invalid register

When guest accesses invalid register, return 0xff instead of exiting.
Also add a log when reading or writing invalid registers.
Signed-off-by: NHervé Poussineau <hpoussin@reactos.org>
Message-Id: <1471505489-1221-3-git-send-email-hpoussin@reactos.org>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: NHervé Poussineau <hpoussin@reactos.org>
上级 64eb7491
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "hw/pci/pci.h" #include "hw/pci/pci.h"
#include "hw/scsi/scsi.h" #include "hw/scsi/scsi.h"
#include "sysemu/dma.h" #include "sysemu/dma.h"
#include "qemu/log.h"
//#define DEBUG_LSI //#define DEBUG_LSI
//#define DEBUG_LSI_REG //#define DEBUG_LSI_REG
...@@ -34,7 +35,6 @@ do { fprintf(stderr, "lsi_scsi: error: " fmt , ## __VA_ARGS__); exit(1);} while ...@@ -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) do { fprintf(stderr, "lsi_scsi: error: " fmt , ## __VA_ARGS__);} while (0)
#endif #endif
#ifdef DEBUG_LSI_REG
static const char *names[] = { static const char *names[] = {
"SCNTL0", "SCNTL1", "SCNTL2", "SCNTL3", "SCID", "SXFER", "SDID", "GPREG", "SCNTL0", "SCNTL1", "SCNTL2", "SCNTL3", "SCID", "SXFER", "SDID", "GPREG",
"SFBR", "SOCL", "SSID", "SBCL", "DSTAT", "SSTAT0", "SSTAT1", "SSTAT2", "SFBR", "SOCL", "SSID", "SBCL", "DSTAT", "SSTAT0", "SSTAT1", "SSTAT2",
...@@ -49,7 +49,6 @@ static const char *names[] = { ...@@ -49,7 +49,6 @@ static const char *names[] = {
"SIDL", "0x51", "0x52", "0x53", "SODL", "0x55", "0x56", "0x57", "SIDL", "0x51", "0x52", "0x53", "SODL", "0x55", "0x56", "0x57",
"SBDL", "0x59", "0x5a", "0x5b", "SCRATCHB0", "SCRATCHB1", "SCRATCHB2", "SCRATCHB3", "SBDL", "0x59", "0x5a", "0x5b", "SCRATCHB0", "SCRATCHB1", "SCRATCHB2", "SCRATCHB3",
}; };
#endif
#define LSI_MAX_DEVS 7 #define LSI_MAX_DEVS 7
...@@ -1715,8 +1714,14 @@ static uint8_t lsi_reg_readb(LSIState *s, int offset) ...@@ -1715,8 +1714,14 @@ static uint8_t lsi_reg_readb(LSIState *s, int offset)
break; break;
} }
default: 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_REG24
#undef CASE_GET_REG32 #undef CASE_GET_REG32
...@@ -1959,7 +1964,10 @@ static void lsi_reg_writeb(LSIState *s, int offset, uint8_t val) ...@@ -1959,7 +1964,10 @@ static void lsi_reg_writeb(LSIState *s, int offset, uint8_t val)
shift = (offset & 3) * 8; shift = (offset & 3) * 8;
s->scratch[n] = deposit32(s->scratch[n], shift, 8, val); s->scratch[n] = deposit32(s->scratch[n], shift, 8, val);
} else { } 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 #undef CASE_SET_REG24
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册