# HG changeset patch # User Paul Boddie # Date 1540682484 -7200 # Node ID 25aa0d4ffa88ecc18fdb68a0714e9a637ee61fbc # Parent f3a4ee69fdfcac80d0e0b2e268cc5c7ff617b1b1 Save and restore the accumulator registers. Otherwise, certain operations, such as those coincidentally employed in the framebuffer copying function, are disrupted and cause erroneous program operations to be performed. diff -r f3a4ee69fdfc -r 25aa0d4ffa88 lib/cpu.S --- a/lib/cpu.S Sat Oct 27 23:45:09 2018 +0200 +++ b/lib/cpu.S Sun Oct 28 01:21:24 2018 +0200 @@ -137,7 +137,7 @@ .set noat #define IRQ_STACK_LIMIT (KSEG0_BASE + IRQ_STACK_SIZE) -#define IRQ_STACK_TOP (IRQ_STACK_LIMIT - 32 * 4) +#define IRQ_STACK_TOP (IRQ_STACK_LIMIT - 34 * 4) int_handler: @@ -153,6 +153,11 @@ sw $\reg, -(\reg * 4)($k0) .endr + mflo $k1 + sw $k1, -(32 * 4)($k0) + mfhi $k1 + sw $k1, -(33 * 4)($k0) + /* Switch to the IRQ stack. */ lui $sp, %hi(IRQ_STACK_TOP) @@ -163,6 +168,11 @@ /* Restore affected registers. */ + lw $k1, -(32 * 4)($k0) + mtlo $k1 + lw $k1, -(33 * 4)($k0) + mthi $k1 + .irp reg, \ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 \ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, \