Merge pull request #982 from MooglyGuy/master

Fix traps in SPARC core
This commit is contained in:
Olivier Galibert 2016-06-21 13:05:18 +02:00 committed by GitHub
commit b88bca35b8
2 changed files with 14 additions and 8 deletions

View File

@ -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;

View File

@ -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;