Commit fb20f65a authored by Olaf Hering's avatar Olaf Hering Committed by Paul Mackerras

[POWERPC] Fix hang in start_ldr if _end or _edata is unaligned

Quick fix for lack of memset(__bss_start, 0, _end-__bss_start) in
load_kernel().  If edata is unaligned, the loop will overwrite all
memory because r3 and r4 will never be equal.
Signed-off-by: default avatarOlaf Hering <olaf@aepfle.de>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent aa7a32cb
...@@ -154,8 +154,8 @@ do_relocate_out: ...@@ -154,8 +154,8 @@ do_relocate_out:
start_ldr: start_ldr:
/* Clear all of BSS and set up stack for C calls */ /* Clear all of BSS and set up stack for C calls */
lis r3,edata@h lis r3,__bss_start@h
ori r3,r3,edata@l ori r3,r3,__bss_start@l
lis r4,end@h lis r4,end@h
ori r4,r4,end@l ori r4,r4,end@l
subi r3,r3,4 subi r3,r3,4
...@@ -163,7 +163,7 @@ start_ldr: ...@@ -163,7 +163,7 @@ start_ldr:
li r0,0 li r0,0
50: stwu r0,4(r3) 50: stwu r0,4(r3)
cmpw cr0,r3,r4 cmpw cr0,r3,r4
bne 50b blt 50b
90: mr r9,r1 /* Save old stack pointer (in case it matters) */ 90: mr r9,r1 /* Save old stack pointer (in case it matters) */
lis r1,.stack@h lis r1,.stack@h
ori r1,r1,.stack@l ori r1,r1,.stack@l
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment