]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
Fix ppc4xx clear_bss() code
authorAnatolij Gustschin <agustschin@t-online.de>
Wed, 5 Dec 2007 16:43:20 +0000 (17:43 +0100)
committerStefan Roese <sr@denx.de>
Thu, 27 Dec 2007 18:35:34 +0000 (19:35 +0100)
ppc4xx clear_bss() fails if BSS segment size is not
divisible by 4 without remainder. This patch provides
fix for this problem.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
cpu/ppc4xx/start.S

index 645ac0b8dd742c895dffaf0168b50e2b12890111..52601ed7003ee3b3d86caeb2d7cf5289261f4840 100644 (file)
@@ -1494,16 +1494,25 @@ clear_bss:
        lwz     r4,GOT(_end)
 
        cmplw   0, r3, r4
-       beq     6f
+       beq     7f
 
        li      r0, 0
-5:
+
+       andi.   r5, r4, 3
+       beq     6f
+       sub     r4, r4, r5
+       mtctr   r5
+       mr      r5, r4
+5:     stb     r0, 0(r5)
+       addi    r5, r5, 1
+       bdnz    5b
+6:
        stw     r0, 0(r3)
        addi    r3, r3, 4
        cmplw   0, r3, r4
-       bne     5b
-6:
+       bne     6b
 
+7:
        mr      r3, r9          /* Init Data pointer            */
        mr      r4, r10         /* Destination Address          */
        bl      board_init_r