[U-Boot] [PATCH 3/4] ARMv8: Allow dynamic early stack pointer

Simon Glass sjg at chromium.org
Mon Jan 8 03:40:45 UTC 2018


Hi Stephen,

On 19 December 2017 at 18:30, Stephen Warren <swarren at wwwdotorg.org> wrote:
> From: Stephen Warren <swarren at nvidia.com>
>
> U-Boot typically uses a hard-coded value for the stack pointer before
> relocation. Implement option SYS_INIT_SP_BSS_OFFSET to instead calculate
> the initial SP at run-time. This is useful to avoid hard-coding addresses
> into U-Boot, so that can be loaded and executed at arbitrary addresses and
> thus avoid using arbitrary addresses at runtime. This option's value is
> the offset added to &_bss_start in order to calculate the stack pointer.
> This offset should be large enough so that the early malloc region, global
> data (gd), and early stack usage do not overlap any appended DTB.

I don't see why this is an offset from bss_start - shouldn't it be bss_end?

Also this seems error-prone since we don't know how large the DTB is.
Can we improve this, e.g. by:

- using binman to provide the stack start value or offset
- checking the DTB size and automatically using the address
immediately after it finishes (again I suppose binman could provide
that)

Regards,
Simon


More information about the U-Boot mailing list