[U-Boot] [PATCH] arm: add 8-byte alignment for ABI compliance before board_init_f
Heiko Schocher
hs at denx.de
Fri Nov 12 08:19:43 CET 2010
Hello Reinhard,
Reinhard Meyer wrote:
> Dear Heiko Schocher,
>> diff --git a/arch/arm/cpu/sa1100/start.S b/arch/arm/cpu/sa1100/start.S
>> index ace0c07..91cdd72 100644
>> --- a/arch/arm/cpu/sa1100/start.S
>> +++ b/arch/arm/cpu/sa1100/start.S
>> @@ -152,6 +152,7 @@ reset:
>> /* Set stackpointer in internal RAM to call board_init_f */
>> call_board_init_f:
>> ldr sp, =(CONFIG_SYS_INIT_SP_ADDR)
>> + bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
>> ldr r0,=0x00000000
>> bl board_init_f
>>
>> diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
>> index 1fd5f83..96c0e30 100644
>> --- a/arch/arm/lib/board.c
>> +++ b/arch/arm/lib/board.c
>> @@ -276,7 +276,7 @@ void board_init_f (ulong bootflag)
>> ulong addr, addr_sp;
>>
>> /* Pointer is writable since we allocated a register for it */
>> - gd = (gd_t *) (CONFIG_SYS_INIT_SP_ADDR);
>> + gd = (gd_t *) ((CONFIG_SYS_INIT_SP_ADDR)& ~0x07);
>> /* compiler optimization barrier needed for GCC>= 3.4 */
>> __asm__ __volatile__("": : :"memory");
>>
>
> 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?
> One further thought, why not init the reserved register in assembly and
> remove the gd relevant code in C? But that bears some risk if the register
> is changed and the assembly is forgotten to adapt..
No, I think this is to risky ...
bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
More information about the U-Boot
mailing list