1.1 --- a/stage2/entry.S Sun Apr 24 19:51:55 2016 +0200
1.2 +++ b/stage2/entry.S Sun Apr 24 22:23:14 2016 +0200
1.3 @@ -21,10 +21,12 @@
1.4 .extern interrupt_handler
1.5 .extern current_registers
1.6 .extern current_stack_pointer
1.7 +.extern enter_task
1.8 .globl _tlb_entry
1.9 .globl _exc_entry
1.10 .globl _irq_entry
1.11 .globl _end_entries
1.12 +.globl _enter_task
1.13 .set noreorder
1.14
1.15 #include "paging.h"
1.16 @@ -72,7 +74,11 @@
1.17
1.18 tlbwr
1.19 nop
1.20 - eret
1.21 +
1.22 + lui $k0, %hi(_enter_task)
1.23 + ori $k0, $k0, %lo(_enter_task)
1.24 + lw $k1, 0($k0)
1.25 + jr $k1
1.26 nop
1.27
1.28 _tlb_entry_direct:
2.1 --- a/stage2/handlers.S Sun Apr 24 19:51:55 2016 +0200
2.2 +++ b/stage2/handlers.S Sun Apr 24 22:23:14 2016 +0200
2.3 @@ -24,6 +24,7 @@
2.4 .extern current_stack_pointer
2.5 .extern current_task
2.6 .globl interrupt_handler
2.7 +.globl enter_task
2.8 .set noreorder
2.9 .set noat
2.10
2.11 @@ -147,6 +148,13 @@
2.12 lw $k0, 124($k1)
2.13 mthi $k0
2.14
2.15 + lui $k0, %hi(_enter_task)
2.16 + ori $k0, $k0, %lo(_enter_task)
2.17 + lw $k1, 0($k0)
2.18 + jr $k1
2.19 + nop
2.20 +
2.21 +enter_task:
2.22 eret
2.23 nop
2.24
3.1 --- a/stage2/head2.S Sun Apr 24 19:51:55 2016 +0200
3.2 +++ b/stage2/head2.S Sun Apr 24 22:23:14 2016 +0200
3.3 @@ -31,23 +31,25 @@
3.4 .extern _got_start
3.5 .extern _got_end
3.6 .extern _got_copy_start
3.7 +.extern enter_task
3.8 .globl _start
3.9 +.globl _enter_task
3.10 .set noreorder
3.11
3.12 _start:
3.13 - b real_start
3.14 + b real_start
3.15 nop
3.16
3.17 /* Apparently reserved region which, if used, breaks the USB Boot process. */
3.18
3.19 - .word 0x0
3.20 - .word 0x0
3.21 - .word 0x0
3.22 - .word 0x0
3.23 - .word 0x0
3.24 - .word 0x0
3.25 - .word 0x0
3.26 - .word 0x0
3.27 + .word 0
3.28 + .word 0
3.29 + .word 0
3.30 + .word 0
3.31 + .word 0
3.32 + .word 0
3.33 + .word 0
3.34 + .word 0
3.35
3.36 real_start:
3.37 /* Initialise the stack. */
3.38 @@ -102,12 +104,23 @@
3.39 mtc0 $t0, $16 /* CP0_CONFIG */
3.40 nop
3.41
3.42 + /* Set up the enter task reference for convenience. */
3.43 +
3.44 + la $t0, enter_task
3.45 + li $t1, 0x80000000
3.46 + /* subu $t0, $t0, $t1 */
3.47 + la $t1, _enter_task
3.48 + sw $t0, 0($t1)
3.49 +
3.50 /* Start the program. */
3.51
3.52 la $t9, c_main /* load the address of the routine */
3.53 j c_main
3.54 nop
3.55
3.56 +_enter_task:
3.57 + .word 0
3.58 +
3.59 _copy:
3.60 /* Copy via $t3 the region from $t0 to $t2 into $t1. */
3.61