1.1 --- a/stage2/entry.S Wed Feb 24 17:26:10 2016 +0100
1.2 +++ b/stage2/entry.S Wed Feb 24 17:59:26 2016 +0100
1.3 @@ -26,20 +26,28 @@
1.4 .set noreorder
1.5
1.6 _tlb_entry:
1.7 - move $k1, $gp
1.8 + /* Save registers that the assembler wants to trash. */
1.9 +
1.10 + sw $t9, -100($sp)
1.11 + sw $gp, -104($sp)
1.12 + sw $ra, -112($sp)
1.13 +
1.14 lui $gp, %hi(_GLOBAL_OFFSET_TABLE_)
1.15 ori $gp, $gp, %lo(_GLOBAL_OFFSET_TABLE_)
1.16 la $k0, tlb_handler
1.17 - move $gp, $k1
1.18 jr $k0
1.19 nop
1.20
1.21 _irq_entry:
1.22 - move $k1, $gp
1.23 + /* Save registers that the assembler wants to trash. */
1.24 +
1.25 + sw $t9, -100($sp)
1.26 + sw $gp, -104($sp)
1.27 + sw $ra, -112($sp)
1.28 +
1.29 lui $gp, %hi(_GLOBAL_OFFSET_TABLE_)
1.30 ori $gp, $gp, %lo(_GLOBAL_OFFSET_TABLE_)
1.31 la $k0, interrupt_handler
1.32 - move $gp, $k1
1.33 jr $k0
1.34 nop
1.35
2.1 --- a/stage2/handlers.S Wed Feb 24 17:26:10 2016 +0100
2.2 +++ b/stage2/handlers.S Wed Feb 24 17:59:26 2016 +0100
2.3 @@ -27,14 +27,13 @@
2.4 .set noat
2.5
2.6 tlb_handler:
2.7 - sw $ra, -112($sp)
2.8 + /* gp should have been set in the entrypoint. */
2.9 +
2.10 jal save_state
2.11 nop
2.12
2.13 /* Invoke the handler. */
2.14
2.15 - lui $gp, %hi(_GLOBAL_OFFSET_TABLE_)
2.16 - ori $gp, $gp, %lo(_GLOBAL_OFFSET_TABLE_)
2.17 jal tlb_handle
2.18 nop
2.19
2.20 @@ -42,14 +41,13 @@
2.21 nop
2.22
2.23 interrupt_handler:
2.24 - sw $ra, -112($sp)
2.25 + /* gp should have been set in the entrypoint. */
2.26 +
2.27 jal save_state
2.28 nop
2.29
2.30 /* Invoke the handler. */
2.31
2.32 - lui $gp, %hi(_GLOBAL_OFFSET_TABLE_)
2.33 - ori $gp, $gp, %lo(_GLOBAL_OFFSET_TABLE_)
2.34 jal irq_handle
2.35 nop
2.36
2.37 @@ -57,7 +55,6 @@
2.38 nop
2.39
2.40 save_state:
2.41 -
2.42 /* Save the status, mask interrupts. */
2.43
2.44 mfc0 $k0, $12 /* CP0_STATUS */
2.45 @@ -90,8 +87,8 @@
2.46 sw $s6, -88($sp)
2.47 sw $s7, -92($sp)
2.48 sw $t8, -96($sp)
2.49 - sw $t9, -100($sp)
2.50 - sw $gp, -104($sp)
2.51 + /* sw $t9, -100($sp) */
2.52 + /* sw $gp, -104($sp) */
2.53 sw $fp, -108($sp)
2.54 /* sw $ra, -112($sp) */
2.55