[U-Boot] [PATCH v2 3/4] ARM: use r9 for gd

Simon Glass
2013-08-19T03:08:24Z

Hi Jeroen,

On Sat, Aug 17, 2013 at 3:40 AM, Jeroen Hofstee <jeroen@myspectrum.nl> wrote:
> On 08/14/2013 08:25 PM, Jeroen Hofstee wrote:
>>
>> To be more EABI compliant and as a preparation for building
>> with clang, use the platform-specific r9 register for gd
>> instead of r8.
>>
>> note: The FIQ is not updated since it is not used in u-boot,
>> and under discussion for the time being.
>>
>> The following checkpatch warning is ignored:
>> WARNING: Use of volatile is usually wrong: see
>> Documentation/volatile-considered-harmful.txt
>>
>> cc: Albert ARIBAUD <albert.u.boot@aribaud.net>
>> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
>> ---
>> arch/arm/config.mk | 2 +-
>> arch/arm/include/asm/global_data.h | 2 +-
>> arch/arm/lib/crt0.S | 16 ++++++++--------
>> 3 files changed, 10 insertions(+), 10 deletions(-)
>>
>
> This patch assumes only crt0.S sets the register used for
> gd in asm. I just noticed cpu/armv7/lowlevel_init.S does set gd
> manually, so all users of the common board.c are likely
> bricked with the patch as is. Looking into it....

I may misunderstood what you are saying here, but I believe that the
code in common/board_f.c which creates a global_data on the stack can
be removed for ARM now that Albert has tidied all this up with the
crt0.S changes, etc. So in common/board_f.c something like:

void board_init_f(ulong boot_flags)
{
/* These two archs set up the global_data before board_init_f() */
#if !defined(CONFIG_X86) && !defined(CONFIG_ARM)
gd_t data;

gd = &data;
#endif

gd->flags = boot_flags;

Regards,
Simon