]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - arch/mips/cpu/xburst/start.S
Merge git://git.denx.de/u-boot-arm
[karo-tx-uboot.git] / arch / mips / cpu / xburst / start.S
index be14b3d7ebb2fb818f8c5f932466c9e9e9a7771d..10dffb4a5cb84c1c740663f3a83c694e0ffdde0a 100644 (file)
@@ -47,14 +47,17 @@ _start:
 relocate_code:
        move    sp, a0                  # set new stack pointer
 
+       move    s0, a1                  # save gd in s0
+       move    s2, a2                  # save destination address in s2
+
        li      t0, CONFIG_SYS_MONITOR_BASE
-       sub     t6, a2, t0              # t6 <-- relocation offset
+       sub     s1, s2, t0              # s1 <-- relocation offset
 
        la      t3, in_ram
        lw      t2, -12(t3)             # t2 <-- __image_copy_end
        move    t1, a2
 
-       add     gp, t6                  # adjust gp
+       add     gp, s1                  # adjust gp
 
        /*
         * t0 = source address
@@ -96,7 +99,7 @@ relocate_code:
        nop
 
        /* Jump to where we've relocated ourselves */
-       addi    t0, a2, in_ram - _start
+       addi    t0, s2, in_ram - _start
        jr      t0
         nop
 
@@ -114,19 +117,19 @@ in_ram:
         * generated by GNU ld. Skip these reserved entries from relocation.
         */
        lw      t3, -4(t0)              # t3 <-- num_got_entries
-       lw      t4, -8(t0)              # t4 <-- _GLOBAL_OFFSET_TABLE_
-       add     t4, t6                  # t4 now holds relocated _G_O_T_
-       addi    t4, t4, 8               # skipping first two entries
+       lw      t8, -8(t0)              # t8 <-- _GLOBAL_OFFSET_TABLE_
+       add     t8, s1                  # t8 now holds relocated _G_O_T_
+       addi    t8, t8, 8               # skipping first two entries
        li      t2, 2
 1:
-       lw      t1, 0(t4)
+       lw      t1, 0(t8)
        beqz    t1, 2f
-        add    t1, t6
-       sw      t1, 0(t4)
+        add    t1, s1
+       sw      t1, 0(t8)
 2:
        addi    t2, 1
        blt     t2, t3, 1b
-        addi   t4, 4
+        addi   t8, 4
 
        /* Update dynamic relocations */
        lw      t1, -16(t0)             # t1 <-- __rel_dyn_start
@@ -136,19 +139,19 @@ in_ram:
         addi   t1, 8
 
 1:
-       lw      t3, -4(t1)              # t3 <-- relocation info
+       lw      t8, -4(t1)              # t8 <-- relocation info
 
-       sub     t3, 3
-       bnez    t3, 2f                  # skip non R_MIPS_REL32 entries
+       li      t3, 3
+       bne     t8, t3, 2f              # skip non R_MIPS_REL32 entries
         nop
 
        lw      t3, -8(t1)              # t3 <-- location to fix up in FLASH
 
-       lw      t4, 0(t3)               # t4 <-- original pointer
-       add     t4, t6                  # t4 <-- adjusted pointer
+       lw      t8, 0(t3)               # t8 <-- original pointer
+       add     t8, s1                  # t8 <-- adjusted pointer
 
-       add     t3, t6                  # t3 <-- location to fix up in RAM
-       sw      t4, 0(t3)
+       add     t3, s1                  # t3 <-- location to fix up in RAM
+       sw      t8, 0(t3)
 
 2:
        blt     t1, t2, 1b
@@ -168,9 +171,9 @@ in_ram:
        blt     t1, t2, 1b
         addi   t1, 4
 
-       move    a0, a1                  # a0 <-- gd
+       move    a0, s0                  # a0 <-- gd
        la      t9, board_init_r
        jr      t9
-        move   a1, a2
+        move   a1, s2
 
        .end    relocate_code