mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM exceptions: Do not use hardcoded STACK_BASE
@ 2012-10-10  7:13 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2012-10-10  7:13 UTC (permalink / raw)
  To: barebox

The exception handlers need some space to write to. Traditionally
this has been some stack space. This is not necessary at all, so
just use some variable and get rid of the compile time fixed stack
address.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/cpu/exceptions.S |   15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/arch/arm/cpu/exceptions.S b/arch/arm/cpu/exceptions.S
index 7f94f9f..fe63a37 100644
--- a/arch/arm/cpu/exceptions.S
+++ b/arch/arm/cpu/exceptions.S
@@ -37,9 +37,6 @@
 #define MODE_SVC	0x13
 #define I_BIT		0x80
 
-_STACK_START:
-	.word STACK_BASE + STACK_SIZE - 4
-
 /*
  * use bad_save_user_regs for abort/prefetch/undef/swi ...
  * use irq_save_user_regs / irq_restore_user_regs for IRQ/FIQ handling
@@ -48,8 +45,7 @@ _STACK_START:
 	.macro	bad_save_user_regs
 	sub	sp, sp, #S_FRAME_SIZE
 	stmia	sp, {r0 - r12}			@ Calling r0-r12
-	ldr	r2, _STACK_START
-	sub	r2, r2, #(8)  @ set base 2 words into abort stack
+	ldr	r2, =abort_stack
 	ldmia	r2, {r2 - r3}			@ get pc, cpsr
 	add	r0, sp, #S_FRAME_SIZE		@ restore sp_SVC
 
@@ -80,9 +76,7 @@ _STACK_START:
 	.endm
 
 	.macro get_bad_stack
-	ldr	r13, _STACK_START
-	sub	r13, r13, #(8) @ reserved a couple spots in abort stack
-
+	ldr	r13, =abort_stack
 	str	lr, [r13]			@ save caller lr / spsr
 	mrs	lr, spsr
 	str     lr, [r13, #4]
@@ -163,3 +157,8 @@ fiq:
 1:	b 1b				/* irq (interrupt) */
 1:	b 1b				/* fiq (fast interrupt) */
 #endif
+
+.section .data
+.align 4
+abort_stack:
+.space 8
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-10-10  7:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-10  7:13 [PATCH] ARM exceptions: Do not use hardcoded STACK_BASE Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox