summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-04-13 17:30:58 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-04-13 17:34:52 +0200
commit2c2f657092781381e9e04fac9e08e6dac034d5bc (patch)
treec3299578c681d2416e3a194c13a5e66c020d6193 /arch
parentc406f591292ccc2af583445c0a8b5f9ade0310e2 (diff)
downloadbarebox-2c2f657092781381e9e04fac9e08e6dac034d5bc.tar.gz
barebox-2c2f657092781381e9e04fac9e08e6dac034d5bc.tar.xz
ARM startup: invalidate I-cache before jumping to relocated binary
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/cpu/start.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c
index ede8fd1f09..0fcc950979 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));