From 028e8c44586890446977c5fce851fc58cb7b741d Mon Sep 17 00:00:00 2001 From: "therealmogminer@gmail.com" Date: Tue, 21 Jun 2016 12:27:55 +0200 Subject: [PATCH] Fix traps --- src/devices/cpu/sparc/mb86901.cpp | 15 ++++++++++----- src/devices/cpu/sparc/sparc.h | 7 ++++--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/devices/cpu/sparc/mb86901.cpp b/src/devices/cpu/sparc/mb86901.cpp index 382aa865522..08794476f31 100644 --- a/src/devices/cpu/sparc/mb86901.cpp +++ b/src/devices/cpu/sparc/mb86901.cpp @@ -166,7 +166,7 @@ void mb86901_device::device_stop() void mb86901_device::device_reset() { m_queued_tt = 0; - m_queued_priority = 0; + m_queued_priority = SPARC_NO_TRAP; m_asi = 0; MAE = false; HOLD_BUS = false; @@ -877,6 +877,7 @@ bool mb86901_device::execute_group2(UINT32 op) else { m_tbr = (arg1 ^ arg2) & 0xfffff000; + printf("wr (%08x ^ %08x) & 0xfffff000 (%08x),tbr", arg1, arg2, m_tbr); } break; case 52: // FPop1 @@ -1352,6 +1353,7 @@ bool mb86901_device::execute_ticc(UINT32 op) { bool trap_taken = evaluate_condition(op); + printf("ticc @ %x\n", PC); if (trap_taken) { UINT32 arg2 = USEIMM ? SIMM7 : RS2REG; @@ -1410,11 +1412,8 @@ void mb86901_device::trap(UINT8 type, UINT8 tt_override) bool mb86901_device::invoke_queued_traps() { - if (m_queued_priority > 0) + if (m_queued_priority != SPARC_NO_TRAP) { - m_queued_priority = 0; - m_queued_tt = 0; - m_et = false; m_ps = m_s; m_s = true; @@ -1430,6 +1429,9 @@ bool mb86901_device::invoke_queued_traps() PC = m_tbr; nPC = m_tbr + 4; + + m_queued_priority = SPARC_NO_TRAP; + m_queued_tt = 0; return true; } @@ -1472,6 +1474,7 @@ void mb86901_device::execute_run() switch (OP2) { case 0: // unimp + printf("unimp @ %x\n", PC); break; case 2: // branch on integer condition codes update_npc = execute_bicc(op); @@ -1480,12 +1483,14 @@ void mb86901_device::execute_run() SET_RDREG(IMM22); break; case 6: // branch on floating-point condition codes + printf("fbfcc @ %x\n", PC); break; #if SPARCV8 case 7: // branch on coprocessor condition codes, SPARCv8 break; #endif default: + printf("unknown %08x @ %x\n", op, PC); break; } break; diff --git a/src/devices/cpu/sparc/sparc.h b/src/devices/cpu/sparc/sparc.h index 324d46137a9..481c23ec515 100644 --- a/src/devices/cpu/sparc/sparc.h +++ b/src/devices/cpu/sparc/sparc.h @@ -9,6 +9,7 @@ #ifndef __SPARC_H__ #define __SPARC_H__ +#define SPARC_NO_TRAP 256 #define SPARC_RESET 0 #define SPARC_INSTRUCTION_ACCESS_EXCEPTION 1 #define SPARC_ILLEGAL_INSTRUCTION 2 @@ -132,9 +133,9 @@ protected: UINT8 m_asi; // other internal states - UINT8 m_trap_priorities[256]; - UINT8 m_queued_tt; - UINT8 m_queued_priority; + UINT32 m_trap_priorities[256]; + UINT32 m_queued_tt; + UINT32 m_queued_priority; bool m_mae; bool m_hold_bus; int m_icount;