From: Reinhard Meyer <u-boot@emk-elektronik.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] arm: add 8-byte alignment for ABI compliance before board_init_f
Date: Fri, 12 Nov 2010 08:06:17 +0100 [thread overview]
Message-ID: <4CDCE769.8080209@emk-elektronik.de> (raw)
In-Reply-To: <1289544835-24425-1-git-send-email-hs@denx.de>
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
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;
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..
Best regards,
Reinhard
next prev parent reply other threads:[~2010-11-12 7:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-12 6:53 [U-Boot] [PATCH] arm: add 8-byte alignment for ABI compliance before board_init_f Heiko Schocher
2010-11-12 7:06 ` Reinhard Meyer [this message]
2010-11-12 7:19 ` Heiko Schocher
2010-11-12 8:04 ` Albert ARIBAUD
2010-11-12 8:50 ` Graeme Russ
2010-11-12 8:50 ` Wolfgang Denk
2010-11-12 9:47 ` Graeme Russ
2010-11-12 9:56 ` Wolfgang Denk
2010-11-12 7:53 ` Albert ARIBAUD
2010-11-12 8:05 ` Heiko Schocher
2010-12-08 22:50 ` Wolfgang Denk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CDCE769.8080209@emk-elektronik.de \
--to=u-boot@emk-elektronik.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox