summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author DavidHaywood <28625134+DavidHaywood@users.noreply.github.com>2020-01-31 00:14:49 +0000
committer DavidHaywood <28625134+DavidHaywood@users.noreply.github.com>2020-01-31 00:14:49 +0000
commit3f63c559b7abe02890e73b92fd47e1fefbd75777 (patch)
tree0b8acc39f86ade59782ebc994aa58553c11c023d
parentc8efa6607c8e06cff5275f06df6b5e16a355cf36 (diff)
likely resolve sunplus crashes on linux (nw)
-rw-r--r--src/devices/cpu/unsp/unsp.cpp9
-rw-r--r--src/devices/cpu/unsp/unsp.h2
2 files changed, 7 insertions, 4 deletions
diff --git a/src/devices/cpu/unsp/unsp.cpp b/src/devices/cpu/unsp/unsp.cpp
index a3e783dd6c9..ff27f97df62 100644
--- a/src/devices/cpu/unsp/unsp.cpp
+++ b/src/devices/cpu/unsp/unsp.cpp
@@ -194,8 +194,6 @@ void unsp_device::device_start()
m_core = (internal_unsp_state *)m_cache.alloc_near(sizeof(internal_unsp_state));
memset(m_core, 0, sizeof(internal_unsp_state));
- m_core->m_r.resize(m_numregs);
-
#if ENABLE_UNSP_DRC
m_enable_drc = allow_drc() && (m_iso < 12);
#else
@@ -299,7 +297,12 @@ void unsp_20_device::device_start()
void unsp_device::device_reset()
{
for (int i = 0; i < m_numregs; i++)
- m_core->m_r[i] = 0;
+ {
+ if (i < m_numregs)
+ m_core->m_r[i] = 0;
+ else
+ m_core->m_r[i] = 0xdeadbeef;
+ }
m_core->m_r[REG_PC] = read16(0xfff7);
m_core->m_enable_irq = 0;
diff --git a/src/devices/cpu/unsp/unsp.h b/src/devices/cpu/unsp/unsp.h
index 691859c6e5f..35a2ced29d3 100644
--- a/src/devices/cpu/unsp/unsp.h
+++ b/src/devices/cpu/unsp/unsp.h
@@ -164,7 +164,7 @@ protected:
struct internal_unsp_state
{
- std::vector<u32> m_r; // why are these 32-bit? they're 16-bit regs? (changing to uint16_t causes crashes tho, so something is depending on this)
+ uint32_t m_r[16]; // why are these 32-bit? they're 16-bit regs? (changing to uint16_t causes crashes tho, so something is depending on this)
uint32_t m_enable_irq;
uint32_t m_enable_fiq;
uint32_t m_irq;