[U-Boot] [PATCH v3 4/4] arm: interrupt_init: set sp in IRQ/FIQ modes

Georges Savoundararadj
2014-10-26T22:25:26Z

Before this commit, the stack addresses for IRQ and FIQ modes,
IRQ_STACK_START and FIQ_STACK_START, were computed in interrupt_init but
they were not used.

This commit sets the stack pointers for IRQ and FIQ modes.

Signed-off-by: Georges Savoundararadj <savoundg@gmail.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

---

Changes in v3:
- None

Changes in v2:
- Reword the commit message

arch/arm/lib/interrupts.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)

diff --git a/arch/arm/lib/interrupts.c b/arch/arm/lib/interrupts.c
index f6b7c03..49c1bf3 100644
--- a/arch/arm/lib/interrupts.c
+++ b/arch/arm/lib/interrupts.c
@@ -34,6 +34,25 @@ int interrupt_init (void)
IRQ_STACK_START_IN = gd->irq_sp + 8;
FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;

+ __asm__ __volatile__("msr cpsr_c, %0\n"
+ "mov sp, %1\n"
+ :
+ : "r" (IRQ_MODE | I_BIT | F_BIT),
+ "r" (IRQ_STACK_START)
+ : "memory");
+
+ __asm__ __volatile__("msr cpsr_c, %0\n"
+ "mov sp, %1\n"
+ :
+ : "r" (FIQ_MODE | I_BIT | F_BIT),
+ "r" (FIQ_STACK_START)
+ : "memory");
+
+ __asm__ __volatile__("msr cpsr_c, %0"
+ :
+ : "r" (SVC_MODE | I_BIT | F_BIT)
+ : "memory");
+
return arch_interrupt_init();
}

--
2.1.2