arch: armv6-m: Introduce setintstack macro

Summary:
- This commit introduces setintstack macro which can be
  overridden for SMP with interrupt stack

Impact:
- SMP only

Testing:
- Tested with raspberrypi-pico:smp
- NOTE: more commits will be added later

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
This commit is contained in:
Masayuki Ishikawa 2021-07-03 09:03:23 +09:00 committed by Xiang Xiao
parent 51b287b084
commit 9f206f2bb6

View File

@ -44,6 +44,11 @@
#include <nuttx/config.h>
#include <arch/irq.h>
#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 */