PSX CPU: hookup debugger_exception_hook & debugger_interrupt_hook [smf]

This commit is contained in:
smf- 2018-07-27 09:47:55 +01:00
parent da224d90a0
commit dbb034ad61

View File

@ -137,6 +137,10 @@
#define CAUSE_EXC ( 31L << 2 ) #define CAUSE_EXC ( 31L << 2 )
#define CAUSE_IP ( 255L << 8 ) #define CAUSE_IP ( 255L << 8 )
// software interrupts
#define CAUSE_IP0 ( 1L << 8 )
#define CAUSE_IP1 ( 1L << 9 )
// hardware interrupts
#define CAUSE_IP2 ( 1L << 10 ) #define CAUSE_IP2 ( 1L << 10 )
#define CAUSE_IP3 ( 1L << 11 ) #define CAUSE_IP3 ( 1L << 11 )
#define CAUSE_IP4 ( 1L << 12 ) #define CAUSE_IP4 ( 1L << 12 )
@ -1436,21 +1440,32 @@ void psxcpu_device::update_rom_config()
} }
} }
void psxcpu_device::update_cop0( int reg ) void psxcpu_device::update_cop0(int reg)
{ {
if( reg == CP0_SR ) if (reg == CP0_SR)
{ {
update_memory_handlers(); update_memory_handlers();
update_address_masks(); update_address_masks();
} }
if( ( reg == CP0_SR || reg == CP0_CAUSE ) && if ((reg == CP0_SR || reg == CP0_CAUSE) &&
( m_cp0r[ CP0_SR ] & SR_IEC ) != 0 && (m_cp0r[CP0_SR] & SR_IEC) != 0)
( m_cp0r[ CP0_SR ] & m_cp0r[ CP0_CAUSE ] & CAUSE_IP ) != 0 )
{ {
m_op = m_cache->read_dword( m_pc ); uint32_t ip = m_cp0r[CP0_SR] & m_cp0r[CP0_CAUSE] & CAUSE_IP;
execute_unstoppable_instructions( 1 ); if (ip != 0)
exception( EXC_INT ); {
if (ip & CAUSE_IP0) debugger_exception_hook(EXC_INT);
if (ip & CAUSE_IP1) debugger_exception_hook(EXC_INT);
if (ip & CAUSE_IP2) debugger_interrupt_hook(PSXCPU_IRQ0);
if (ip & CAUSE_IP3) debugger_interrupt_hook(PSXCPU_IRQ1);
if (ip & CAUSE_IP4) debugger_interrupt_hook(PSXCPU_IRQ2);
if (ip & CAUSE_IP5) debugger_interrupt_hook(PSXCPU_IRQ3);
if (ip & CAUSE_IP6) debugger_interrupt_hook(PSXCPU_IRQ4);
if (ip & CAUSE_IP7) debugger_interrupt_hook(PSXCPU_IRQ5);
m_op = m_cache->read_dword(m_pc);
execute_unstoppable_instructions(1);
exception(EXC_INT);
}
} }
} }
@ -1588,9 +1603,12 @@ void psxcpu_device::common_exception( int exception, uint32_t romOffset, uint32_
m_cp0r[ CP0_EPC ] = m_pc; m_cp0r[ CP0_EPC ] = m_pc;
} }
if( LOG_BIOSCALL && exception != EXC_INT ) if (exception != EXC_INT)
{ {
logerror( "%08x: Exception %d\n", m_pc, exception ); if (LOG_BIOSCALL)
logerror("%08x: Exception %d\n", m_pc, exception);
debugger_exception_hook(exception);
} }
m_delayr = 0; m_delayr = 0;