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