]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
MIPS: start.S: optimize BSS initialization
authorDaniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tue, 12 Feb 2013 21:22:13 +0000 (22:22 +0100)
committerDaniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tue, 12 Feb 2013 21:22:13 +0000 (22:22 +0100)
Get the start and end address for clearing BSS from the newly
introduced symbols __bss_start and __bss_end. After GOT is
relocated, those symbols are already pointing to the correct
addresses.

Also optimize the loop by moving the address incrementation
to the delay slot to avoid the initial sub instruction.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
arch/mips/cpu/mips32/start.S
arch/mips/cpu/mips64/start.S
arch/mips/cpu/xburst/start.S

index 7373d4edc42f0c424ee147fe6813a6e4076d5b47..cd8b914da317248a6bd9f4bf1d9d5e37a3f5eed1 100644 (file)
@@ -228,17 +228,19 @@ in_ram:
        blt     t2, t3, 1b
         addi   t4, 4
 
-       /* Clear BSS */
-       lw      t1, -12(t0)             # t1 <-- uboot_end_data
-       lw      t2, -8(t0)              # t2 <-- uboot_end
-       add     t1, s1                  # adjust pointers
-       add     t2, s1
+       /*
+        * Clear BSS
+        *
+        * GOT is now relocated. Thus __bss_start and __bss_end can be
+        * accessed directly via $gp.
+        */
+       la      t1, __bss_start         # t1 <-- __bss_start
+       la      t2, __bss_end           # t2 <-- __bss_end
 
-       sub     t1, 4
 1:
-       addi    t1, 4
-       bltl    t1, t2, 1b
-        sw     zero, 0(t1)
+       sw      zero, 0(t1)
+       blt     t1, t2, 1b
+        addi   t1, 4
 
        move    a0, s0                  # a0 <-- gd
        la      t9, board_init_r
index c0ae41a18a09ccbc10fca8646dd00f3b2ddaea88..ba4ca4de38e010073d3a8027b74e309259fbfb90 100644 (file)
@@ -220,17 +220,19 @@ in_ram:
        blt     t2, t3, 1b
         daddi  t8, 8
 
-       /* Clear BSS */
-       ld      t1, -24(t0)             # t1 <-- uboot_end_data
-       ld      t2, -16(t0)             # t2 <-- uboot_end
-       dadd    t1, s1                  # adjust pointers
-       dadd    t2, s1
+       /*
+        * Clear BSS
+        *
+        * GOT is now relocated. Thus __bss_start and __bss_end can be
+        * accessed directly via $gp.
+        */
+       dla     t1, __bss_start         # t1 <-- __bss_start
+       dla     t2, __bss_end           # t2 <-- __bss_end
 
-       dsub    t1, 8
 1:
-       daddi   t1, 8
-       bltl    t1, t2, 1b
-        sd     zero, 0(t1)
+       sd      zero, 0(t1)
+       blt     t1, t2, 1b
+        daddi  t1, 8
 
        move    a0, s0                  # a0 <-- gd
        dla     t9, board_init_r
index 50b7fb102172f6c32ea50b2f8b65ebf6485f9a1f..bd9390ae5e396431480eee744c5e93018f150093 100644 (file)
@@ -143,16 +143,19 @@ in_ram:
        blt     t2, t3, 1b
         addi   t4, 4
 
-       /* Clear BSS */
-       lw      t1, -12(t0)             # t1 <-- uboot_end_data
-       lw      t2, -8(t0)              # t2 <-- uboot_end
-       add     t1, t6                  # adjust pointers
-       add     t2, t6
-
-       sub     t1, 4
-1:     addi    t1, 4
-       bltl    t1, t2, 1b
-        sw     zero, 0(t1)
+       /*
+        * Clear BSS
+        *
+        * GOT is now relocated. Thus __bss_start and __bss_end can be
+        * accessed directly via $gp.
+        */
+       la      t1, __bss_start         # t1 <-- __bss_start
+       la      t2, __bss_end           # t2 <-- __bss_end
+
+1:
+       sw      zero, 0(t1)
+       blt     t1, t2, 1b
+        addi   t1, 4
 
        move    a0, a1                  # a0 <-- gd
        la      t9, board_init_r