summaryrefslogtreecommitdiffstats
path: root/arch/arm/include/asm
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2016-12-18 22:05:52 -0800
committerSascha Hauer <s.hauer@pengutronix.de>2017-01-09 17:01:29 +0100
commitbb9125c93ef38757a436fe0f941c8c63fbc0477e (patch)
tree3637e2f7190b634b7fe6b0dc0a77916931bbf01a /arch/arm/include/asm
parent51a2a8e7c9caf8a629723c6765d5a401d7ed7d2f (diff)
downloadbarebox-bb9125c93ef38757a436fe0f941c8c63fbc0477e.tar.gz
barebox-bb9125c93ef38757a436fe0f941c8c63fbc0477e.tar.xz
ARM: Fix a bug in stack's "top" initialization
Code-paths responsible for initializing CPU's stack pointer and variable used in stack memory resource reservation got out of sync which resulted in actual stack being 64K off from what "stack" struct resource registered by arm_request_stack() thought it was. At least one issue resulting from that can be easily triggered by running: memtest -t This commit unifies the aforementioned code to a certain degree which solves the problem and hopefuly makes it less likely to become an issue again. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/include/asm')
-rw-r--r--arch/arm/include/asm/barebox-arm.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h
index 061296a476..e8dfd02389 100644
--- a/arch/arm/include/asm/barebox-arm.h
+++ b/arch/arm/include/asm/barebox-arm.h
@@ -94,10 +94,16 @@ static inline void arm_fixup_vectors(void)
void *barebox_arm_boot_dtb(void);
+static inline unsigned long arm_mem_stack_top(unsigned long membase,
+ unsigned long endmem)
+{
+ return endmem - SZ_64K;
+}
+
static inline unsigned long arm_mem_stack(unsigned long membase,
unsigned long endmem)
{
- return endmem - SZ_64K - STACK_SIZE;
+ return arm_mem_stack_top(membase, endmem) - STACK_SIZE;
}
static inline unsigned long arm_mem_ttb(unsigned long membase,