Fix taking traps in SPARC core

This commit is contained in:
therealmogminer@gmail.com 2016-07-05 16:35:32 +02:00
parent 20724e105c
commit 016a6bd61b
2 changed files with 21 additions and 7 deletions

View File

@ -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)
{

View File

@ -12,7 +12,7 @@
#include "sparcdasm.h"
#define SPARCV8 (0)
#define LOG_FCODES (0)
#define LOG_FCODES (1)
#if LOG_FCODES
#include <map>