[U-Boot] [PATCH v7 2/2] arm: move gd handling outside of C code

Simon Glass sjg at chromium.org
Fri Nov 27 03:51:55 CET 2015


On 25 November 2015 at 08:56, Albert ARIBAUD <albert.u.boot at aribaud.net> wrote:
> As of gcc 5.2.1 for Thumb-1, it is not possible any
> more to assign gd from C code, as gd is mapped to r9,
> and r9 may now be saved in the prolog sequence, and
> restored in the epilog sequence, of any C functions.
>
> Therefore arch_setup_gd(), which is supposed to set
> r9, may actually have no effect, causing U-Boot to
> use a bad address to access GD.
>
> Fix this by never calling arch_setup_gd() for ARM,
> and instead setting r9 in arch/arm/lib/crt0.S, to
> the value returned by board_init_f_alloc_reserve().
>
> Signed-off-by: Albert ARIBAUD <albert.u.boot at aribaud.net>
> ---
>
> Changes in v7:
> - also fix common/spl/spl.c assignment to gd
>
> Changes in v6:
> - moved ARM r9 fix into its own patch
>
> Changes in v5: None
> Changes in v4: None
> Changes in v3: None
> Changes in v2: None
>
>  arch/arm/lib/crt0.S      |  3 +++
>  common/init/board_init.c |  8 ++++----
>  common/spl/spl.c         | 26 +++++++++++++++-----------
>  3 files changed, 22 insertions(+), 15 deletions(-)

Reviewed-by: Simon Glass <sjg at chromium.org>


More information about the U-Boot mailing list