From dbb034ad61477d9072c42ed83c8547d925085beb Mon Sep 17 00:00:00 2001 From: smf- Date: Fri, 27 Jul 2018 09:47:55 +0100 Subject: PSX CPU: hookup debugger_exception_hook & debugger_interrupt_hook [smf] --- src/devices/cpu/psx/psx.cpp | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/src/devices/cpu/psx/psx.cpp b/src/devices/cpu/psx/psx.cpp index f74d998fed4..a8366bdea91 100644 --- a/src/devices/cpu/psx/psx.cpp +++ b/src/devices/cpu/psx/psx.cpp @@ -137,6 +137,10 @@ #define CAUSE_EXC ( 31L << 2 ) #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_IP3 ( 1L << 11 ) #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_address_masks(); } - if( ( reg == CP0_SR || reg == CP0_CAUSE ) && - ( m_cp0r[ CP0_SR ] & SR_IEC ) != 0 && - ( m_cp0r[ CP0_SR ] & m_cp0r[ CP0_CAUSE ] & CAUSE_IP ) != 0 ) + if ((reg == CP0_SR || reg == CP0_CAUSE) && + (m_cp0r[CP0_SR] & SR_IEC) != 0) { - m_op = m_cache->read_dword( m_pc ); - execute_unstoppable_instructions( 1 ); - exception( EXC_INT ); + uint32_t ip = m_cp0r[CP0_SR] & m_cp0r[CP0_CAUSE] & CAUSE_IP; + if (ip != 0) + { + 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; } - 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; -- cgit v1.2.3