From 3f63c559b7abe02890e73b92fd47e1fefbd75777 Mon Sep 17 00:00:00 2001 From: DavidHaywood <28625134+DavidHaywood@users.noreply.github.com> Date: Fri, 31 Jan 2020 00:14:49 +0000 Subject: likely resolve sunplus crashes on linux (nw) --- src/devices/cpu/unsp/unsp.cpp | 9 ++++++--- src/devices/cpu/unsp/unsp.h | 2 +- 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 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; -- cgit v1.2.3