[U-Boot] [PATCH] arm: add 8-byte alignment for ABI compliance before board_init_f

Graeme Russ graeme.russ at gmail.com
Fri Nov 12 09:50:56 CET 2010


On 12/11/10 18:19, Heiko Schocher wrote:
> Hello Reinhard,
> 
> Reinhard Meyer wrote:
>> Dear Heiko Schocher,
>>> diff --git a/arch/arm/cpu/sa1100/start.S b/arch/arm/cpu/sa1100/start.S

>> Is bootflag ever used? If not, why not change the parameter to
> 
> No.
> 
>> give the gd address to board_init_f?
>>
>>     ld r0, sp (whatever the exact assembly syntax for that would be)
>>
>> void board_init_f (gd_t *gd_addr)
>> ...
>>     gd = gd_addr;
> 
> I thought this too, but in arch/powerpc/lib/board.c it is used as bootflag,
> so I didn;t want to touch this ... but looking in arch/*/lib/board.c
> this first parameter is not always used as bootflag ... so I think
> that would be good ... opinions?
> 

For x86, I use the parameter as a pointer to gd and put boot flags in gd:

void board_init_f (ulong gdp)
{

The memory layout for x86 is:

+--Top of Memory-+
|                |
|     Stack      |
|                |
+----------------+
|                |
|  Global Data   |
|                |
+----------------+
|                |
|  U-Boot Code   |
|    + Data      |
|                |
+----------------+ <-- dest_addr (see below)
|                |
|      BSS       |
|                |
+----------------+
|                |
|  malloc area   |
|                |
+----------------+
|                |
|  Free Memory   |
/                /

So passing the pointer to gd also serves to calculate the relocation address:

	/* Calculate destination RAM Address and relocation offset */
	dest_addr  = (void *)gdp - (bss_end - text_start);
	rel_offset = dest_addr - text_start;


Regards,

Graeme


More information about the U-Boot mailing list