2.1 --- a/stage2/entry.S Tue Jun 23 23:08:19 2015 +0200
2.2 +++ b/stage2/entry.S Wed Jun 24 13:29:41 2015 +0200
2.3 @@ -20,6 +20,7 @@
2.4 .text
2.5 .extern real_exception_handler
2.6 .globl _tlb_entry
2.7 +.globl _cache_entry
2.8 .globl _exc_entry
2.9 .globl _irq_entry
2.10 .globl _end_entries
2.11 @@ -31,6 +32,12 @@
2.12 jr $k0
2.13 nop
2.14
2.15 +_cache_entry:
2.16 + lui $k0, %hi(real_exception_handler)
2.17 + ori $k0, $k0, %lo(real_exception_handler)
2.18 + jr $k0
2.19 + nop
2.20 +
2.21 _exc_entry:
2.22 lui $k0, %hi(real_exception_handler)
2.23 ori $k0, $k0, %lo(real_exception_handler)
4.1 --- a/stage2/head2.S Tue Jun 23 23:08:19 2015 +0200
4.2 +++ b/stage2/head2.S Wed Jun 24 13:29:41 2015 +0200
4.3 @@ -34,13 +34,16 @@
4.4
4.5 la $sp, 0x80080000
4.6
4.7 + /* Initialise the globals pointer. */
4.8 +
4.9 + lui $gp, %hi(_GLOBAL_OFFSET_TABLE_)
4.10 + ori $gp, $gp, %lo(_GLOBAL_OFFSET_TABLE_)
4.11 +
4.12 /* Copy TLB handling instructions. */
4.13
4.14 - lui $t0, %hi(_tlb_entry) /* start */
4.15 - ori $t0, $t0, %lo(_tlb_entry)
4.16 + la $t0, _tlb_entry /* start */
4.17 li $t1, 0x80000000
4.18 - lui $t2, %hi(_exc_entry) /* end */
4.19 - ori $t2, $t2, %lo(_exc_entry)
4.20 + la $t2, _cache_entry /* end */
4.21 _tlb_copy:
4.22 lw $t3, 0($t0)
4.23 addiu $t0, $t0, 4
4.24 @@ -48,12 +51,23 @@
4.25 bne $t0, $t2, _tlb_copy
4.26 addiu $t1, $t1, 4 /* executed in delay slot before branch */
4.27
4.28 + /* Copy cache handling instructions. */
4.29 +
4.30 + move $t0, $t2 /* start */
4.31 + li $t1, 0x80000100
4.32 + la $t2, _exc_entry /* end */
4.33 +_cache_copy:
4.34 + lw $t3, 0($t0)
4.35 + addiu $t0, $t0, 4
4.36 + sw $t3, 0($t1)
4.37 + bne $t0, $t2, _cache_copy
4.38 + addiu $t1, $t1, 4 /* executed in delay slot before branch */
4.39 +
4.40 /* Copy exception handling instructions. */
4.41
4.42 move $t0, $t2 /* start */
4.43 li $t1, 0x80000180
4.44 - lui $t2, %hi(_irq_entry) /* end */
4.45 - ori $t2, $t2, %lo(_irq_entry)
4.46 + la $t2, _irq_entry /* end */
4.47 _exc_copy:
4.48 lw $t3, 0($t0)
4.49 addiu $t0, $t0, 4
4.50 @@ -65,8 +79,7 @@
4.51
4.52 move $t0, $t2 /* start */
4.53 li $t1, 0x80000200
4.54 - lui $t2, %hi(_end_entries) /* end */
4.55 - ori $t2, $t2, %lo(_end_entries)
4.56 + la $t2, _end_entries /* end */
4.57 _irq_copy:
4.58 lw $t3, 0($t0)
4.59 addiu $t0, $t0, 4