Tue, 30 Nov 2010 01:51:22 +0000
[musashi] add preliminary bus error exception triggering
src/musashi/m68k.h | file | annotate | diff | revisions | |
src/musashi/m68kcpu.c | file | annotate | diff | revisions | |
src/musashi/m68kcpu.h | file | annotate | diff | revisions |
1.1 --- a/src/musashi/m68k.h Mon Nov 29 00:20:40 2010 +0000 1.2 +++ b/src/musashi/m68k.h Tue Nov 30 01:51:22 2010 +0000 1.3 @@ -280,6 +280,10 @@ 1.4 void m68k_pulse_halt(void); 1.5 1.6 1.7 +/* Trigger a bus error exception */ 1.8 +void m68k_pulse_bus_error(void); 1.9 + 1.10 + 1.11 /* Context switching to allow multiple CPUs */ 1.12 1.13 /* Get the size of the cpu context in bytes */
2.1 --- a/src/musashi/m68kcpu.c Mon Nov 29 00:20:40 2010 +0000 2.2 +++ b/src/musashi/m68kcpu.c Tue Nov 30 01:51:22 2010 +0000 2.3 @@ -724,6 +724,13 @@ 2.4 } 2.5 2.6 2.7 +/* Trigger a Bus Error exception */ 2.8 +void m68k_pulse_buserr(void) 2.9 +{ 2.10 + m68ki_exception_bus_error(); 2.11 +} 2.12 + 2.13 + 2.14 /* Pulse the RESET line on the CPU */ 2.15 void m68k_pulse_reset(void) 2.16 {
3.1 --- a/src/musashi/m68kcpu.h Mon Nov 29 00:20:40 2010 +0000 3.2 +++ b/src/musashi/m68kcpu.h Tue Nov 30 01:51:22 2010 +0000 3.3 @@ -916,6 +916,7 @@ 3.4 INLINE void m68ki_exception_trapN(uint vector); 3.5 INLINE void m68ki_exception_trace(void); 3.6 INLINE void m68ki_exception_privilege_violation(void); 3.7 +INLINE void m68ki_exception_bus_error(void); 3.8 INLINE void m68ki_exception_1010(void); 3.9 INLINE void m68ki_exception_1111(void); 3.10 INLINE void m68ki_exception_illegal(void); 3.11 @@ -1684,6 +1685,18 @@ 3.12 USE_CYCLES(CYC_EXCEPTION[EXCEPTION_PRIVILEGE_VIOLATION] - CYC_INSTRUCTION[REG_IR]); 3.13 } 3.14 3.15 +/* Exception for bus error */ 3.16 +INLINE void m68ki_exception_bus_error(void) 3.17 +{ 3.18 + uint sr = m68ki_init_exception(); 3.19 + m68ki_stack_frame_0000(REG_PC, sr, EXCEPTION_BUS_ERROR); 3.20 + m68ki_jump_vector(EXCEPTION_BUS_ERROR); 3.21 + 3.22 + /* Use up some clock cycles and undo the instruction's cycles */ 3.23 + USE_CYCLES(CYC_EXCEPTION[EXCEPTION_BUS_ERROR] - CYC_INSTRUCTION[REG_IR]); 3.24 +} 3.25 + 3.26 + 3.27 /* Exception for A-Line instructions */ 3.28 INLINE void m68ki_exception_1010(void) 3.29 {