This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 5fa31048b2bc12d84f881659d14a5866d8758ed1 Author: wangmingrong1 <[email protected]> AuthorDate: Fri Feb 7 14:19:39 2025 +0800 arch/armv8m: Register alignment Due to the existence of the four-byte alignment reserve, the input and output interrupts must be synchronized Signed-off-by: wangmingrong1 <[email protected]> Signed-off-by: hujun5 <[email protected]> --- arch/arm/include/arm_m/irq.h | 8 +++++++- arch/arm/src/armv8-m/arm_exception.S | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/arm/include/arm_m/irq.h b/arch/arm/include/arm_m/irq.h index f1b0a713283..00cd6d77a50 100644 --- a/arch/arm/include/arm_m/irq.h +++ b/arch/arm/include/arm_m/irq.h @@ -121,7 +121,13 @@ #ifdef CONFIG_ARMV8M_STACKCHECK_HARDWARE # define REG_SPLIM (SW_INT_REGS + SW_FPU_REGS + 0) /* REG_SPLIM */ -# define REG_ALIGN (SW_INT_REGS + SW_FPU_REGS + 1) /* For 8-bytes align */ + +/* REG_ALIGN For 8-bytes align + * If Enabling CONFIG_ARMV8M_STACKCHECK_HARDWARE + * it will push a value to this location + */ + +# define REG_ALIGN (SW_INT_REGS + SW_FPU_REGS + 1) # define SW_XCPT_REGS (SW_INT_REGS + SW_FPU_REGS + 2) #else # define SW_XCPT_REGS (SW_INT_REGS + SW_FPU_REGS) diff --git a/arch/arm/src/armv8-m/arm_exception.S b/arch/arm/src/armv8-m/arm_exception.S index 793597cde99..00dee5079ba 100644 --- a/arch/arm/src/armv8-m/arm_exception.S +++ b/arch/arm/src/armv8-m/arm_exception.S @@ -144,7 +144,7 @@ exception_common: mrsne r0, psplim msrne psplim, r3 - stmdb r1!, {r0} + stmdb r1!, {r0, r3} #endif mrs r3, basepri /* R3=Current BASEPRI setting */ @@ -209,7 +209,6 @@ exception_common: beq 3f /* Branch if context already on the handle mode */ #ifdef CONFIG_ENABLE_ALL_SIGNALS sub r2, r1, #XCPTCONTEXT_SIZE /* Reserve signal context */ - bic r2, r2, #7 /* Get the stack pointer with 8-byte alignment */ mov sp, r2 /* Instantiate the aligned stack */ #endif 3: @@ -237,6 +236,7 @@ exception_common: #ifdef CONFIG_ARMV8M_STACKCHECK_HARDWARE ldmia r0!, {r1} /* Get psplim/msplim */ + add r0, r0, #4 #endif /* The EXC_RETURN value tells us whether we are returning on the MSP or PSP
