From 016a6bd61b019bc1c515cdeffe4b856ad38e8b5a Mon Sep 17 00:00:00 2001 From: "therealmogminer@gmail.com" Date: Tue, 5 Jul 2016 16:35:32 +0200 Subject: [PATCH 1/3] Fix taking traps in SPARC core --- src/devices/cpu/sparc/mb86901.cpp | 26 ++++++++++++++++++++------ src/devices/cpu/sparc/sparc.h | 2 +- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/devices/cpu/sparc/mb86901.cpp b/src/devices/cpu/sparc/mb86901.cpp index fea2908952f..fd7aa4b5430 100644 --- a/src/devices/cpu/sparc/mb86901.cpp +++ b/src/devices/cpu/sparc/mb86901.cpp @@ -1071,7 +1071,10 @@ void mb86901_device::execute_rdsr(UINT32 op) } } else if (RDPSR) + { + MAKE_PSR; RDREG = PSR; + } else if (RDWIM) RDREG = WIM; else if (RDTBR) @@ -1170,7 +1173,9 @@ void mb86901_device::execute_wrsr(UINT32 op) else { PSR = result &~ PSR_ZERO_MASK; + printf("WRPSR: %08x\n", result); } + BREAK_PSR; } else if (WRWIM) { @@ -1194,6 +1199,7 @@ void mb86901_device::execute_wrsr(UINT32 op) else { TBR = result & 0xfffff000; + printf("TBR: %08x\n", TBR); } } } @@ -2602,6 +2608,8 @@ void mb86901_device::select_trap() m_tt = 0x10 | m_interrupt_level; TBR |= m_tt << 4; + printf("TBR is now: %08x\n", TBR); + m_trap = 0; m_instruction_access_exception = 0; m_illegal_instruction = 0; m_privileged_instruction = 0; @@ -2719,7 +2727,10 @@ void mb86901_device::execute_trap() { ET = 0; PS = S; + S = 1; CWP = ((CWP + NWINDOWS) - 1) % NWINDOWS; + MAKE_PSR; + update_gpr_pointers(); if (m_annul == 0) { @@ -2733,22 +2744,20 @@ void mb86901_device::execute_trap() m_annul = 0; } - S = 1; if (!m_reset_trap) { PC = TBR; nPC = TBR + 4; + printf("Not reset trap, new PC: %08x\n", PC); } else { + printf("Reset trap, new PC: %08x\n", PC); PC = 0; nPC = 4; m_reset_trap = 0; } } - - MAKE_PSR; - update_gpr_pointers(); } @@ -2947,9 +2956,14 @@ void mb86901_device::execute_step() { m_trap = 1; m_interrupt_level = m_bp_irl; + printf("trap 1, interrupt level %d\n", m_bp_irl); } - if (m_trap) execute_trap(); + if (m_trap) + { + execute_trap(); + debugger_instruction_hook(this, PC); + } if (m_execute_mode) { @@ -3114,7 +3128,7 @@ void mb86901_device::execute_run() continue; } - debugger_instruction_hook(this, m_pc); + debugger_instruction_hook(this, PC); if (m_reset_mode) { diff --git a/src/devices/cpu/sparc/sparc.h b/src/devices/cpu/sparc/sparc.h index cca7a70eceb..185105427c1 100644 --- a/src/devices/cpu/sparc/sparc.h +++ b/src/devices/cpu/sparc/sparc.h @@ -12,7 +12,7 @@ #include "sparcdasm.h" #define SPARCV8 (0) -#define LOG_FCODES (0) +#define LOG_FCODES (1) #if LOG_FCODES #include From e448f04a7f144190016fb6547df817c7c92ea1bb Mon Sep 17 00:00:00 2001 From: "therealmogminer@gmail.com" Date: Tue, 5 Jul 2016 16:38:21 +0200 Subject: [PATCH 2/3] Remove some debug printfs --- src/devices/cpu/sparc/mb86901.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/devices/cpu/sparc/mb86901.cpp b/src/devices/cpu/sparc/mb86901.cpp index fd7aa4b5430..f575af6ebec 100644 --- a/src/devices/cpu/sparc/mb86901.cpp +++ b/src/devices/cpu/sparc/mb86901.cpp @@ -1173,7 +1173,6 @@ void mb86901_device::execute_wrsr(UINT32 op) else { PSR = result &~ PSR_ZERO_MASK; - printf("WRPSR: %08x\n", result); } BREAK_PSR; } @@ -1199,7 +1198,6 @@ void mb86901_device::execute_wrsr(UINT32 op) else { TBR = result & 0xfffff000; - printf("TBR: %08x\n", TBR); } } } @@ -2608,7 +2606,6 @@ void mb86901_device::select_trap() m_tt = 0x10 | m_interrupt_level; TBR |= m_tt << 4; - printf("TBR is now: %08x\n", TBR); m_trap = 0; m_instruction_access_exception = 0; m_illegal_instruction = 0; @@ -2748,11 +2745,9 @@ void mb86901_device::execute_trap() { PC = TBR; nPC = TBR + 4; - printf("Not reset trap, new PC: %08x\n", PC); } else { - printf("Reset trap, new PC: %08x\n", PC); PC = 0; nPC = 4; m_reset_trap = 0; @@ -2956,7 +2951,6 @@ void mb86901_device::execute_step() { m_trap = 1; m_interrupt_level = m_bp_irl; - printf("trap 1, interrupt level %d\n", m_bp_irl); } if (m_trap) From 018c2216c02bd7758d9046ab651b1e873354a66d Mon Sep 17 00:00:00 2001 From: "therealmogminer@gmail.com" Date: Tue, 5 Jul 2016 16:39:22 +0200 Subject: [PATCH 3/3] Turn fcode logging back off --- src/devices/cpu/sparc/sparc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/cpu/sparc/sparc.h b/src/devices/cpu/sparc/sparc.h index 185105427c1..cca7a70eceb 100644 --- a/src/devices/cpu/sparc/sparc.h +++ b/src/devices/cpu/sparc/sparc.h @@ -12,7 +12,7 @@ #include "sparcdasm.h" #define SPARCV8 (0) -#define LOG_FCODES (1) +#define LOG_FCODES (0) #if LOG_FCODES #include