summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Patrick Mackinlay <pmackinlay@hotmail.com>2021-02-01 13:24:50 +0700
committer Patrick Mackinlay <pmackinlay@hotmail.com>2021-02-01 13:24:50 +0700
commite9b945a4b8b40542e54110684aba5f947e601aec (patch)
treeb07b6d1e79a13322e2acce841246facae10ca0ce
parent77e8172b6b2bc292662c46cebd6049595384e412 (diff)
r4000: save exception pc on reset
-rw-r--r--src/devices/cpu/mips/r4000.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/devices/cpu/mips/r4000.cpp b/src/devices/cpu/mips/r4000.cpp
index e0d5d8559a7..fcdddbaabe9 100644
--- a/src/devices/cpu/mips/r4000.cpp
+++ b/src/devices/cpu/mips/r4000.cpp
@@ -59,7 +59,7 @@
#define USE_ABI_REG_NAMES 1
-// cpu instruction fiels
+// cpu instruction fields
#define RSREG ((op >> 21) & 31)
#define RTREG ((op >> 16) & 31)
#define RDREG ((op >> 11) & 31)
@@ -94,6 +94,9 @@ r4000_base_device::r4000_base_device(machine_config const &mconfig, device_type
: cpu_device(mconfig, type, tag, owner, clock)
, m_program_config_le("program", ENDIANNESS_LITTLE, 64, 32)
, m_program_config_be("program", ENDIANNESS_BIG, 64, 32)
+ , m_r{}
+ , m_cp0{}
+ , m_f{}
, m_fcr0(fcr)
{
m_cp0[CP0_PRId] = prid;
@@ -194,15 +197,18 @@ void r4000_base_device::device_start()
void r4000_base_device::device_reset()
{
+ if (!m_hard_reset)
+ {
+ m_cp0[CP0_Status] = SR_BEV | SR_ERL | SR_SR;
+ m_cp0[CP0_ErrorEPC] = m_pc;
+ }
+ else
+ m_cp0[CP0_Status] = SR_BEV | SR_ERL;
+
m_branch_state = NONE;
m_pc = s64(s32(0xbfc00000));
m_r[0] = 0;
- if (m_hard_reset)
- m_cp0[CP0_Status] = SR_BEV | SR_ERL;
- else
- m_cp0[CP0_Status] = SR_BEV | SR_ERL | SR_SR;
-
m_cp0[CP0_Wired] = 0;
m_cp0[CP0_Compare] = 0;
m_cp0[CP0_Count] = 0;