Commit 42ed33ffe135f618680f9d6e9712eb35a85bcb62
Committed by
Stefan Roese
1 parent
85dc2a7f82
Exists in
master
and in
54 other branches
Fix ppc4xx clear_bss() code
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>
Showing 1 changed file with 13 additions and 4 deletions Side-by-side Diff
cpu/ppc4xx/start.S
... | ... | @@ -1494,16 +1494,25 @@ |
1494 | 1494 | lwz r4,GOT(_end) |
1495 | 1495 | |
1496 | 1496 | cmplw 0, r3, r4 |
1497 | - beq 6f | |
1497 | + beq 7f | |
1498 | 1498 | |
1499 | 1499 | li r0, 0 |
1500 | -5: | |
1500 | + | |
1501 | + andi. r5, r4, 3 | |
1502 | + beq 6f | |
1503 | + sub r4, r4, r5 | |
1504 | + mtctr r5 | |
1505 | + mr r5, r4 | |
1506 | +5: stb r0, 0(r5) | |
1507 | + addi r5, r5, 1 | |
1508 | + bdnz 5b | |
1509 | +6: | |
1501 | 1510 | stw r0, 0(r3) |
1502 | 1511 | addi r3, r3, 4 |
1503 | 1512 | cmplw 0, r3, r4 |
1504 | - bne 5b | |
1505 | -6: | |
1513 | + bne 6b | |
1506 | 1514 | |
1515 | +7: | |
1507 | 1516 | mr r3, r9 /* Init Data pointer */ |
1508 | 1517 | mr r4, r10 /* Destination Address */ |
1509 | 1518 | bl board_init_r |