From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/2] ARM startup: invalidate I-cache before jumping to relocated binary
Date: Wed, 23 May 2012 22:28:59 +0200 [thread overview]
Message-ID: <1337804940-9512-1-git-send-email-s.hauer@pengutronix.de> (raw)
barebox can startup with I-cache enabled, so to be on the safe
side we should invalidate the I-cache before jumping to a binary
we just copied in place.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/cpu/start.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c
index ede8fd1..0fcc950 100644
--- a/arch/arm/cpu/start.c
+++ b/arch/arm/cpu/start.c
@@ -135,6 +135,9 @@ void __naked __section(.text_ll_return) board_init_lowlevel_return(void)
/* clear bss */
memset(__bss_start, 0, __bss_stop - __bss_start);
+ /* flush I-cache before jumping to the copied binary */
+ __asm__ __volatile__("mcr p15, 0, %0, c7, c5, 0" : : "r" (0));
+
/* call start_barebox with its absolute address */
r = (unsigned int)&start_barebox;
__asm__ __volatile__("mov pc, %0" : : "r"(r));
--
1.7.10
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2012-05-23 20:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-23 20:28 Sascha Hauer [this message]
2012-05-23 20:29 ` [PATCH 2/2] ARM startup: Do call __mmu_cache_flush during startup Sascha Hauer
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=1337804940-9512-1-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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