diff --git a/ChangeLog b/ChangeLog index e9b8232bb..57af49bb2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-07-16 Vladimir Serbinenko + + * grub-core/kern/powerpc/ieee1275/startup.S: Handle unaligned bss. + Reported by: Paulo Flabiano Smorigo. + 2013-07-14 Vladimir Testov * grub-core/gfxmenu/gui_list.c: USe viewport when drawing strings. diff --git a/grub-core/kern/powerpc/ieee1275/startup.S b/grub-core/kern/powerpc/ieee1275/startup.S index b26c47edb..21c884b43 100644 --- a/grub-core/kern/powerpc/ieee1275/startup.S +++ b/grub-core/kern/powerpc/ieee1275/startup.S @@ -34,14 +34,31 @@ _start: /* Stage1 won't zero BSS for us. In other cases, why not do it again? */ lis 6, (__bss_start - 4)@h ori 6, 6, (__bss_start - 4)@l + +2: stb 2, 4(6) + addi 6, 6, 1 + andi. 7, 6, 3 + cmpi 0, 1, 7, 0 + bne 2b + lis 7, (_end - 4)@h ori 7, 7, (_end - 4)@l subf 7, 6, 7 + subi 8, 7, 1 + andi. 8, 8, 3 + addi 8, 8, 1 + sub 7, 7, 8 + srwi 7, 7, 2 /* We store 4 bytes at a time. */ mtctr 7 2: stwu 2, 4(6) /* We know r2 is already 0 from above. */ bdnz 2b + mtctr 8 +2: stb 2, 4(6) /* We know r2 is already 0 from above. */ + addi 6, 6, 1 + bdnz 2b + /* Store r5 in grub_ieee1275_entry_fn. */ lis 9, grub_ieee1275_entry_fn@ha stw 5, grub_ieee1275_entry_fn@l(9)