[PATCH 3/4] ARM: Do not use last 64KiB of address space for barebox

Sascha Hauer s.hauer at pengutronix.de
Fri Apr 1 05:05:18 PDT 2016


The last 64KiB of address space may be used for the vector table at
0xffff0000, so we cannot use it for barebox. The easiest way to archieve
this is to never use the last 64KiB of memory.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 arch/arm/cpu/entry.c               | 3 ++-
 arch/arm/include/asm/barebox-arm.h | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/entry.c b/arch/arm/cpu/entry.c
index 3b74c6a..0cdcfec 100644
--- a/arch/arm/cpu/entry.c
+++ b/arch/arm/cpu/entry.c
@@ -1,6 +1,7 @@
 #include <types.h>
 
 #include <asm/cache.h>
+#include <asm/barebox-arm.h>
 
 #include "entry.h"
 
@@ -26,7 +27,7 @@
 void __naked __noreturn barebox_arm_entry(unsigned long membase,
 					  unsigned long memsize, void *boarddata)
 {
-	arm_setup_stack(membase + memsize - 16);
+	arm_setup_stack(arm_mem_stack(membase, membase + memsize) + STACK_SIZE - 16);
 	arm_early_mmu_cache_invalidate();
 
 	if (IS_ENABLED(CONFIG_PBL_MULTI_IMAGES))
diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h
index 6713326..8e7b45c 100644
--- a/arch/arm/include/asm/barebox-arm.h
+++ b/arch/arm/include/asm/barebox-arm.h
@@ -97,7 +97,7 @@ void *barebox_arm_boot_dtb(void);
 static inline unsigned long arm_mem_stack(unsigned long membase,
 					  unsigned long endmem)
 {
-	return endmem - STACK_SIZE;
+	return endmem - SZ_64K - STACK_SIZE;
 }
 
 static inline unsigned long arm_mem_ttb(unsigned long membase,
-- 
2.7.0




More information about the barebox mailing list