[U-Boot] RFC: Aligning arch initialisation sequences

Graeme Russ graeme.russ at gmail.com
Sun Nov 14 20:34:37 CET 2010


On 15/11/10 06:23, Wolfgang Denk wrote:
> Dear Albert ARIBAUD,
> 
> In message <4CE0221A.7030502 at free.fr> you wrote:
>>
>> Alright, then I think we should document how we comply, or do not
>> comply, with GNU EABI / AAPCS (maybe a README.arm that people could read
>> up) -- and I think if there is a way to access GD both before and after
>> relocation without making a register unavailable to the whole u-boot
>> code, then we should use it.
> 
> By the way - it should be not difficult to use a normal extern pointer
> to reference the global data; see
> "arch/powerpc/include/asm/global_data.h":
> 
> 194 #if 1
> 195 #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r2")
> 196 #else /* We could use plain global data, but the resulting code is bigger */
> 197 #define XTRN_DECLARE_GLOBAL_DATA_PTR    extern
> 198 #define DECLARE_GLOBAL_DATA_PTR     XTRN_DECLARE_GLOBAL_DATA_PTR \
> 199                                     gd_t *gd
> 200 #endif

I think you will find this peculiar to PowerPC

What you are talking about is exactly how x86 defines gd, but for x86, gd
is not accessible until after relocation

> 
> When I implemented this code I tested both versions. There is not
> much of a difference, except that the register based version results
> in smaller code.
> 

Probably due to one less register load from memory for each gd access

Regards,

Graeme


More information about the U-Boot mailing list