[U-Boot] [U-Boot, v7, 2/2] arm: move gd handling outside of C code
Stephen Warren
swarren at wwwdotorg.org
Thu Jan 14 19:35:39 CET 2016
On 01/14/2016 06:20 AM, Tom Rini wrote:
> On Wed, Nov 25, 2015 at 05:56:33PM +0100, Albert ARIBAUD 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>
>> Reviewed-by: Simon Glass <sjg at chromium.org>
>
> Applied to u-boot/master, thanks!
FYI, this commit causes U-Boot to fail (crash or hang during very early
startup with zero UART output) on at least an NVIDIA Jetson TX1
(p2371-2180) board. Reverting just this in u-boot/master solves the
issue. I have not tested other boards or looked at the code itself yet.
(As an interesting datapoint, this is the first issue caught by the
Jenkins system I'm setting up to run test/py on a few Tegra boards)
More information about the U-Boot
mailing list