* [PATCH] ARM U-Boot BSS zeroing
@ 2013-05-13 15:37 Leif Lindholm
2013-05-13 16:09 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-05-14 13:02 ` Goswin von Brederlow
0 siblings, 2 replies; 4+ messages in thread
From: Leif Lindholm @ 2013-05-13 15:37 UTC (permalink / raw)
To: grub-devel; +Cc: patches
[-- Attachment #1: Type: text/plain, Size: 432 bytes --]
The import into the collaborative branch discarded the call to
get_real_bss_start before starting the BSS zeroing operation.
While get_real_bss_start might have been a bit of an ugly hack,
simply discarding it means that we now end up doing unaligned
STR operations, and any platform with MMU disabled fails to boot.
The attached patch prepends a bytewise zeroing loop until
word-aligned, and then continue as before.
/
Leif
[-- Attachment #2: bss_zero_fix.patch --]
[-- Type: text/x-diff, Size: 592 bytes --]
=== modified file 'grub-core/kern/arm/uboot/startup.S'
--- grub-core/kern/arm/uboot/startup.S 2013-05-03 13:07:39 +0000
+++ grub-core/kern/arm/uboot/startup.S 2013-05-13 14:59:43 +0000
@@ -100,7 +100,13 @@
@ Since we _are_ the C run-time, we need to manually zero the BSS
@ region before continuing
ldr r0, =EXT_C(__bss_start) @ zero from here
- ldr r1, =EXT_C(_end) @ to here
+ @ If unaligned, bytewise zero until base address aligned.
+ mov r1, #0
+1: tst r0, #3
+ beq 2f
+ strb r1, [r0], #1
+ b 1b
+2: ldr r1, =EXT_C(_end) @ to here
mov r2, #0
1: str r2, [r0], #4
cmp r0, r1
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] ARM U-Boot BSS zeroing
2013-05-13 15:37 [PATCH] ARM U-Boot BSS zeroing Leif Lindholm
@ 2013-05-13 16:09 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-05-14 13:02 ` Goswin von Brederlow
1 sibling, 0 replies; 4+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2013-05-13 16:09 UTC (permalink / raw)
To: The development of GNU GRUB
[-- Attachment #1: Type: text/plain, Size: 792 bytes --]
Could you request savannah membership so you have commit rights to this
branch?
Will you be at LinuxTag?
On 13.05.2013 17:37, Leif Lindholm wrote:
> The import into the collaborative branch discarded the call to
> get_real_bss_start before starting the BSS zeroing operation.
>
> While get_real_bss_start might have been a bit of an ugly hack,
> simply discarding it means that we now end up doing unaligned
> STR operations, and any platform with MMU disabled fails to boot.
>
> The attached patch prepends a bytewise zeroing loop until
> word-aligned, and then continue as before.
>
> /
> Leif
>
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ARM U-Boot BSS zeroing
2013-05-13 15:37 [PATCH] ARM U-Boot BSS zeroing Leif Lindholm
2013-05-13 16:09 ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2013-05-14 13:02 ` Goswin von Brederlow
2013-05-14 16:09 ` Vladimir 'phcoder' Serbinenko
1 sibling, 1 reply; 4+ messages in thread
From: Goswin von Brederlow @ 2013-05-14 13:02 UTC (permalink / raw)
To: grub-devel
On Mon, May 13, 2013 at 03:37:32PM +0000, Leif Lindholm wrote:
> The import into the collaborative branch discarded the call to
> get_real_bss_start before starting the BSS zeroing operation.
>
> While get_real_bss_start might have been a bit of an ugly hack,
> simply discarding it means that we now end up doing unaligned
> STR operations, and any platform with MMU disabled fails to boot.
>
> The attached patch prepends a bytewise zeroing loop until
> word-aligned, and then continue as before.
>
> /
> Leif
> === modified file 'grub-core/kern/arm/uboot/startup.S'
> --- grub-core/kern/arm/uboot/startup.S 2013-05-03 13:07:39 +0000
> +++ grub-core/kern/arm/uboot/startup.S 2013-05-13 14:59:43 +0000
> @@ -100,7 +100,13 @@
> @ Since we _are_ the C run-time, we need to manually zero the BSS
> @ region before continuing
> ldr r0, =EXT_C(__bss_start) @ zero from here
> - ldr r1, =EXT_C(_end) @ to here
> + @ If unaligned, bytewise zero until base address aligned.
> + mov r1, #0
> +1: tst r0, #3
> + beq 2f
> + strb r1, [r0], #1
> + b 1b
> +2: ldr r1, =EXT_C(_end) @ to here
> mov r2, #0
> 1: str r2, [r0], #4
> cmp r0, r1
What if I have a 1 byte BSS aligned at 1 byte? You would zero 3 bytes
and overshoot _end and then what happens after the cmp in the last line?
MfG
Goswin
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ARM U-Boot BSS zeroing
2013-05-14 13:02 ` Goswin von Brederlow
@ 2013-05-14 16:09 ` Vladimir 'phcoder' Serbinenko
0 siblings, 0 replies; 4+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2013-05-14 16:09 UTC (permalink / raw)
To: The development of GNU GRUB
[-- Attachment #1: Type: text/plain, Size: 1795 bytes --]
On May 14, 2013 3:02 PM, "Goswin von Brederlow" <goswin-v-b@web.de> wrote:
>
> On Mon, May 13, 2013 at 03:37:32PM +0000, Leif Lindholm wrote:
> > The import into the collaborative branch discarded the call to
> > get_real_bss_start before starting the BSS zeroing operation.
> >
> > While get_real_bss_start might have been a bit of an ugly hack,
> > simply discarding it means that we now end up doing unaligned
> > STR operations, and any platform with MMU disabled fails to boot.
> >
> > The attached patch prepends a bytewise zeroing loop until
> > word-aligned, and then continue as before.
> >
> > /
> > Leif
>
> > === modified file 'grub-core/kern/arm/uboot/startup.S'
> > --- grub-core/kern/arm/uboot/startup.S 2013-05-03 13:07:39 +0000
> > +++ grub-core/kern/arm/uboot/startup.S 2013-05-13 14:59:43 +0000
> > @@ -100,7 +100,13 @@
> > @ Since we _are_ the C run-time, we need to manually zero the BSS
> > @ region before continuing
> > ldr r0, =EXT_C(__bss_start) @ zero from here
> > - ldr r1, =EXT_C(_end) @ to here
> > + @ If unaligned, bytewise zero until base address aligned.
> > + mov r1, #0
> > +1: tst r0, #3
> > + beq 2f
> > + strb r1, [r0], #1
> > + b 1b
> > +2: ldr r1, =EXT_C(_end) @ to here
> > mov r2, #0
> > 1: str r2, [r0], #4
> > cmp r0, r1
>
> What if I have a 1 byte BSS aligned at 1 byte? You would zero 3 bytes
> and overshoot _end and then what happens after the cmp in the last line?
>
Abaolutely irrelevant. our BSS isn't that small
> MfG
> Goswin
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
[-- Attachment #2: Type: text/html, Size: 2435 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-05-14 16:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-13 15:37 [PATCH] ARM U-Boot BSS zeroing Leif Lindholm
2013-05-13 16:09 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-05-14 13:02 ` Goswin von Brederlow
2013-05-14 16:09 ` Vladimir 'phcoder' Serbinenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.