2021-03-07 04:58:59 +11:00
|
|
|
@ An interrupt handler that simply acknowledges all interrupts
|
|
|
|
.arm
|
2021-06-27 11:46:32 +10:00
|
|
|
.global InterruptHandler
|
2021-06-26 06:40:07 +10:00
|
|
|
.section .iwram, "ax"
|
2021-03-07 04:58:59 +11:00
|
|
|
.align
|
2021-06-27 11:46:32 +10:00
|
|
|
InterruptHandler:
|
2021-07-04 05:42:12 +10:00
|
|
|
mov r2, #0x04000000 @ interrupt enable register location
|
|
|
|
add r2, #0x200
|
2021-06-24 04:06:24 +10:00
|
|
|
|
2021-06-26 08:34:58 +10:00
|
|
|
mov r1, #0
|
|
|
|
strh r1, [r2, #8]
|
|
|
|
|
2021-06-24 21:30:40 +10:00
|
|
|
ldrh r1, [r2] @ load 16 bit interrupt enable to r1
|
|
|
|
ldrh r3, [r2, #2] @ load 16 bit interrupt request to r3
|
2021-04-04 03:37:09 +10:00
|
|
|
and r0, r1, r3 @ interrupts both enabled and requested
|
2021-06-24 03:47:03 +10:00
|
|
|
|
2021-06-24 08:33:09 +10:00
|
|
|
@ change to system mode
|
2021-07-04 05:42:12 +10:00
|
|
|
mrs r1, cpsr
|
|
|
|
orr r1, r1, #0xD
|
|
|
|
msr cpsr_c, r1
|
2021-06-24 03:47:03 +10:00
|
|
|
|
2021-06-24 04:06:24 +10:00
|
|
|
@ call the rust interrupt handler with r0 set to the triggered interrupts
|
2021-06-24 03:47:03 +10:00
|
|
|
ldr r1, =__RUST_INTERRUPT_HANDLER
|
2021-07-04 05:42:12 +10:00
|
|
|
push {lr, r2}
|
2021-06-24 08:33:32 +10:00
|
|
|
mov lr, pc
|
2021-06-24 03:47:03 +10:00
|
|
|
bx r1
|
2021-07-04 05:42:12 +10:00
|
|
|
pop {lr, r2}
|
2021-06-24 03:47:03 +10:00
|
|
|
|
2021-06-24 08:33:09 +10:00
|
|
|
@ change back to interrupt mode
|
2021-07-04 05:42:12 +10:00
|
|
|
mrs r1, cpsr
|
|
|
|
bic r1, r1, #0xD
|
|
|
|
msr cpsr_c, r1
|
2021-06-26 08:34:58 +10:00
|
|
|
|
2021-07-04 03:41:59 +10:00
|
|
|
mov r1, #1
|
2021-06-26 08:34:58 +10:00
|
|
|
strh r1, [r2, #8]
|
|
|
|
|
2021-07-04 05:42:12 +10:00
|
|
|
strh r0, [r2, #2] @ store to interrupt request
|
|
|
|
|
|
|
|
ldr r2, =0x03007FF8 @ load bios interrupt request location
|
|
|
|
ldrh r1, [r2] @ load bios interrupt requests
|
|
|
|
orr r1, r1, r0 @ or with enabled and requested interrupts
|
|
|
|
strh r1, [r2] @ acknowlege bios requests
|
|
|
|
|
2021-04-04 03:37:09 +10:00
|
|
|
bx lr @ return to bios
|
2021-04-13 10:33:05 +10:00
|
|
|
.pool
|