From a305dd56e4fcf5d74b3bfb5e4d91f1e48e6e1298 Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 6 Oct 2008 16:20:53 +0000 Subject: Add option for ARM interrupt stack git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@981 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/arch/arm/src/common/up_vectors.S | 36 ++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'nuttx/arch/arm/src/common/up_vectors.S') diff --git a/nuttx/arch/arm/src/common/up_vectors.S b/nuttx/arch/arm/src/common/up_vectors.S index 6d4c79e7d..e97683a16 100644 --- a/nuttx/arch/arm/src/common/up_vectors.S +++ b/nuttx/arch/arm/src/common/up_vectors.S @@ -128,7 +128,15 @@ up_vectorirq: mov fp, #0 /* Init frame pointer */ mov r0, sp /* Get r0=xcp */ + +#if CONFIG_ARCH_INTERRUPTSTACK > 3 + ldr sp, .Lirqstackbase /* SP = interrupt stack base */ + str r0, [sp] /* Save the user stack pointer */ + bl up_decodeirq /* Call the handler */ + ldr sp, [sp] /* Restore the user stack pointer */ +#else bl up_decodeirq /* Call the handler */ +#endif /* Restore the CPSR, SVC modr registers and return */ .Lnoirqset: @@ -138,8 +146,11 @@ up_vectorirq: .Lirqtmp: .word g_irqtmp +#if CONFIG_ARCH_INTERRUPTSTACK > 3 +.Lirqstackbase: + .word up_stackbase +#endif .size up_vectorirq, . - up_vectorirq - .align 5 /************************************************************************************ @@ -404,4 +415,25 @@ up_vectorfiq: subs pc, lr, #4 .size up_vectofiq, . - up_vectorfiq - .align 5 +/************************************************************************************ + * Name: up_interruptstack/g_userstack + * + * Description: + * Shouldn't happen + * + ************************************************************************************/ + +#if CONFIG_ARCH_INTERRUPTSTACK > 3 + .bss + .align 4 + .globl g_userstack + .type g_userstack, object +up_interruptstack: + .skip ((CONFIG_ARCH_INTERRUPTSTACK & ~3) - 4) +g_userstack: +up_stackbase: + .skip 4 + .size g_userstack, 4 + .size up_interruptstack, (CONFIG_ARCH_INTERRUPTSTACK & ~3) +#endif + .end -- cgit v1.2.3