[PATCH v2 07/34] ARM: define stack base consistently

Sascha Hauer s.hauer at pengutronix.de
Wed May 17 02:03:13 PDT 2023


The different arm_mem_* functions have the pattern that they take
the region above it and substract the size of the current region. follow
the pattern for getting the stack base as well. While at it move
arm_mem_stack_top() lower in the file so that we have all functions
following said pattern below each other.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 arch/arm/include/asm/barebox-arm.h | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h
index 139ecce06d..8d8c102081 100644
--- a/arch/arm/include/asm/barebox-arm.h
+++ b/arch/arm/include/asm/barebox-arm.h
@@ -86,11 +86,9 @@ static inline const void *arm_mem_scratch_get(void)
 	return (const void *)arm_mem_scratch(arm_mem_endmem_get());
 }
 
-#define arm_mem_stack_top(endmem) ((endmem) - SZ_64K)
-
 static inline unsigned long arm_mem_stack(unsigned long endmem)
 {
-	return arm_mem_stack_top(endmem) - STACK_SIZE;
+	return arm_mem_scratch(endmem) - STACK_SIZE;
 }
 
 static inline unsigned long arm_mem_ttb(unsigned long endmem)
@@ -122,6 +120,11 @@ static inline unsigned long arm_mem_ramoops(unsigned long endmem)
 	return endmem;
 }
 
+static inline unsigned long arm_mem_stack_top(unsigned long endmem)
+{
+	return arm_mem_stack(endmem) + STACK_SIZE;
+}
+
 static inline unsigned long arm_mem_barebox_image(unsigned long membase,
 						  unsigned long endmem,
 						  unsigned long size)
-- 
2.39.2




More information about the barebox mailing list