[U-Boot] Most ARM CPU's have buggy clear_bss?

Sughosh Ganu
2010-10-27T08:01:11Z

hi,

On Wed Oct 27, 2010 at 10:26:06AM +0300, Darius Augulis wrote:

> IMO, if relocation is skipped, r4 should be loaded with value of
> _TEXT_BASE, not reloc address?
> It seems like r3 is prepared for this but, it's somehow missing? It's
> not used at all.
> Maybe it could be reason why I'm facing strange problem, when after
> relocating uboot with nand_spl no one command is not working.
> I debugged that command table is empty. I think this ASM code clears
> not bss area but something else.

<snip>

>
> Also relocation code looks a bit strange:

<snip>

> r0 is compared to r6, which contains reloc address. All instructions
> between loading r0 and comparison are confusing, because they do not
> impact comparison result.
> Also they do not matter in clear_bss so I think would be great to
> change code like this:
>
> mov sp, r4
>
> adr r0, _start
> cmp r0, r6
> beq clear_bss
> ldr r2, _TEXT_BASE
> ldr r3, _bss_start_ofs
> add r2, r0, r3 /* r2 <- source end address */
>
> Any comments are welcome!

Not sure which core are you referring to. I checked for arm926ejs,
and we have conditional code inclusion based on the definition of
CONFIG_SYS_ARM_WITHOUT_RELOC. So the start address in both the cases
is determined based on whether relocation is enabled or not.

-sughosh