1.1 --- a/stage2/head2.S Tue Jun 30 19:38:56 2015 +0200
1.2 +++ b/stage2/head2.S Fri Jul 03 14:59:43 2015 +0200
1.3 @@ -41,53 +41,41 @@
1.4 lui $gp, %hi(_GLOBAL_OFFSET_TABLE_)
1.5 ori $gp, $gp, %lo(_GLOBAL_OFFSET_TABLE_)
1.6
1.7 + move $k0, $ra
1.8 +
1.9 /* Copy TLB handling instructions. */
1.10
1.11 la $t0, _tlb_entry /* start */
1.12 li $t1, 0x80000000
1.13 la $t2, _cache_entry /* end */
1.14 -_tlb_copy:
1.15 - lw $t3, 0($t0)
1.16 - addiu $t0, $t0, 4
1.17 - sw $t3, 0($t1)
1.18 - bne $t0, $t2, _tlb_copy
1.19 - addiu $t1, $t1, 4 /* executed in delay slot before branch */
1.20 + jal _copy
1.21 + nop
1.22
1.23 /* Copy cache handling instructions. */
1.24
1.25 move $t0, $t2 /* start */
1.26 li $t1, 0x80000100
1.27 la $t2, _exc_entry /* end */
1.28 -_cache_copy:
1.29 - lw $t3, 0($t0)
1.30 - addiu $t0, $t0, 4
1.31 - sw $t3, 0($t1)
1.32 - bne $t0, $t2, _cache_copy
1.33 - addiu $t1, $t1, 4 /* executed in delay slot before branch */
1.34 + jal _copy
1.35 + nop
1.36
1.37 /* Copy exception handling instructions. */
1.38
1.39 move $t0, $t2 /* start */
1.40 li $t1, 0x80000180
1.41 la $t2, _irq_entry /* end */
1.42 -_exc_copy:
1.43 - lw $t3, 0($t0)
1.44 - addiu $t0, $t0, 4
1.45 - sw $t3, 0($t1)
1.46 - bne $t0, $t2, _exc_copy
1.47 - addiu $t1, $t1, 4 /* executed in delay slot before branch */
1.48 + jal _copy
1.49 + nop
1.50
1.51 /* Copy IRQ handling instructions. */
1.52
1.53 move $t0, $t2 /* start */
1.54 li $t1, 0x80000200
1.55 la $t2, _end_entries /* end */
1.56 -_irq_copy:
1.57 - lw $t3, 0($t0)
1.58 - addiu $t0, $t0, 4
1.59 - sw $t3, 0($t1)
1.60 - bne $t0, $t2, _irq_copy
1.61 - addiu $t1, $t1, 4 /* executed in delay slot before branch */
1.62 + jal _copy
1.63 + nop
1.64 +
1.65 + move $ra, $k0
1.66
1.67 /* Enable caching. */
1.68
1.69 @@ -100,4 +88,15 @@
1.70 j c_main
1.71 nop
1.72
1.73 +_copy:
1.74 + /* Copy via $t3 the region from $t0 to $t2 into $t1. */
1.75 +
1.76 + lw $t3, 0($t0)
1.77 + addiu $t0, $t0, 4
1.78 + sw $t3, 0($t1)
1.79 + bne $t0, $t2, _copy
1.80 + addiu $t1, $t1, 4 /* executed in delay slot before branch */
1.81 + j $ra
1.82 + nop
1.83 +
1.84 .set reorder