From: Sascha Hauer <s.hauer@pengutronix.de>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: sp uninitialized in imx6_cpu_lowlevel_init
Date: Mon, 19 Jan 2015 08:30:21 +0100 [thread overview]
Message-ID: <20150119073021.GI18220@pengutronix.de> (raw)
In-Reply-To: <20150116202728.GY22880@pengutronix.de>
On Fri, Jan 16, 2015 at 09:27:28PM +0100, Uwe Kleine-König wrote:
> Hello,
>
> when building imx_v7_defconfig and then looking at
> images/start_imx6_gk802.pbl (several more are affected, too), I get:
>
> $ objdump -d images/start_imx6_gk802.pbl
> 00000000 <start_imx6_gk802>:
> 0: e28f9001 add r9, pc, #1
> 4: e12fff19 bx r9
> 8: f000 f822 bl 50 <start_imx6_gk802+0x50>
> ...
> 50: f000 f850 bl f4 <__start_imx6_gk802>
> ...
> f4: f000 f80c bl 110 <imx6_cpu_lowlevel_init>
> ...
> 110: b508 push {r3, lr}
>
> That is the sp register is used here without being initialized. I guess
> this didn't break up to now because when barebox is jumped into, sp
> was already used by the boot rom and still points into SRAM.
>
> Still I think this is worth to be fixed. I think this means that
> imx6_cpu_lowlevel_init must be marked __naked and lr must be saved into
> a register that is preserved by the functions called by
> imx6_cpu_lowlevel_init.
>
> Sounds reasonable?
I think we should rather setup a stack before calling
imx6_cpu_lowlevel_init. We have SRAM for that so we can use it.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2015-01-19 7:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-16 20:27 Uwe Kleine-König
2015-01-19 7:30 ` Sascha Hauer [this message]
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=20150119073021.GI18220@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=u.kleine-koenig@pengutronix.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