[U-Boot] [PATCH v5] arm: Fix clear bss loop for zero length bss

Christian Riesch christian.riesch at omicron.at
Thu Dec 1 08:53:30 CET 2011


Hi Albert,

On Wed, Nov 30, 2011 at 9:13 PM, Albert ARIBAUD
<albert.u.boot at aribaud.net> wrote:
> Le 29/11/2011 11:58, Christian Riesch a écrit :
>> This patch fixes the clear bss loop for bss sections that have
>> zero length, i.e., where __bss_start == __bss_end__.
[...]
>> diff --git a/arch/arm/cpu/arm926ejs/start.S
>> b/arch/arm/cpu/arm926ejs/start.S
>> index 8b5355b..772793c 100644
>> --- a/arch/arm/cpu/arm926ejs/start.S
>> +++ b/arch/arm/cpu/arm926ejs/start.S
>> @@ -299,10 +299,12 @@ clear_bss:
>>  #endif
>>        mov     r2, #0x00000000         /* clear
>>  */
>>
>> -clbss_l:str    r2, [r0]                /* clear loop...
>>  */
>> +clbss_l:cmp    r0, r1                  /* clear loop...
>>  */
>> +       beq     clbss_e
>
>
> For safety, you had better use a bge here, in case r1-r0 is not a multiple
> of 4.

Shouldn't it be bhs instead because we are dealing with unsigned
numbers here? bge is signed >=.

Regards, Christian

>
>
>> +       str     r2, [r0]
>>        add     r0, r0, #4
>> -       cmp     r0, r1
>> -       bne     clbss_l
>> +       b       clbss_l
>> +clbss_e:
>>
>>  #ifndef CONFIG_SPL_BUILD
>>        bl coloured_LED_init
>
>
> Amicalement,
> --
> Albert.
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot


More information about the U-Boot mailing list