diff --git a/arch/arm/src/armv6-m/arm_exception.S b/arch/arm/src/armv6-m/arm_exception.S index a2200be6df0..b71a912bbb6 100644 --- a/arch/arm/src/armv6-m/arm_exception.S +++ b/arch/arm/src/armv6-m/arm_exception.S @@ -44,6 +44,11 @@ #include #include + +#ifdef CONFIG_SMP +# include "chip.h" +#endif + #include "exc_return.h" /**************************************************************************** @@ -53,6 +58,26 @@ .globl exception_common .file "arm_exception.S" +/**************************************************************************** + * Macro Definitions + ****************************************************************************/ + +/**************************************************************************** + * Name: setintstack + * + * Description: + * Set the current stack pointer to the "top" the interrupt stack. Single CPU + * case. Must be provided by MCU-specific logic in the SMP case. + * + ****************************************************************************/ + +#if !defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 3 + .macro setintstack, tmp1, tmp2 + ldr \tmp1, =g_intstacktop + mov sp, \tmp1 + .endm +#endif + /**************************************************************************** * .text ****************************************************************************/ @@ -142,8 +167,7 @@ exception_common: */ #if CONFIG_ARCH_INTERRUPTSTACK > 3 - ldr r7, =g_intstacktop /* R7=Top of the interrupt stack */ - mov sp, r7 /* Set the new stack point */ + setintstack r7, r6 /* SP = IRQ stack top */ push {r1} /* Save the MSP on the interrupt stack */ bl arm_doirq /* R0=IRQ, R1=register save area on stack */ pop {r1} /* Recover R1=main stack pointer */