fix interrupt enable/disable macros

This commit is contained in:
Connor Olding 2018-08-24 05:13:08 +02:00
parent a90005a79e
commit 8aab789a24

View file

@ -1,15 +1,22 @@
macro EnableInt() {
lli t0, 0xAAA
lli t1, 0xFF01
lli t0, MI_INTR_MASK_ALL_SET
lui a0, MI_BASE
sw t0, MI_INTR_MASK(a0)
// careful not to touch unrelated flags here
mfc0 t1, CP0_Status
lli t0, CP0_STATUS_IM_ALL
or t1, t0
mtc0 t1, CP0_Status
}
macro DisableInt() {
lli t0, 0x555
lli t1, 0x0001
lli t0, MI_INTR_MASK_ALL_CLR
lui a0, MI_BASE
sw t0, MI_INTR_MASK(a0)
// careful not to touch unrelated flags here
mfc0 t1, CP0_Status
lli t0, CP0_STATUS_IM_ALL
nor t0, r0 // invert the mask (including upper halfword)
and t1, t0
mtc0 t1, CP0_Status
}