This is an automated email from the ASF dual-hosted git repository.

masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit c369e471072e9204db83ad5bfbd0a621a8c69f83
Author: chao.an <anc...@xiaomi.com>
AuthorDate: Sun Feb 27 12:38:22 2022 +0800

    arm/armv7-a/r: handle swi on interrupt stack
    
    Signed-off-by: chao.an <anc...@xiaomi.com>
---
 arch/arm/src/armv7-a/arm_vectors.S | 14 ++++++++++++++
 arch/arm/src/armv7-r/arm_vectors.S | 14 ++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/arch/arm/src/armv7-a/arm_vectors.S 
b/arch/arm/src/armv7-a/arm_vectors.S
index 237bf43..f3a2319 100644
--- a/arch/arm/src/armv7-a/arm_vectors.S
+++ b/arch/arm/src/armv7-a/arm_vectors.S
@@ -343,10 +343,24 @@ arm_vectorsvc:
 
        mov             fp, #0                          /* Init frame pointer */
        mov             r0, sp                          /* Get r0=xcp */
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 7
+       /* Call arm_syscall() on the interrupt stack */
+
+       setirqstack     r1, r3                          /* SP = interrupt stack 
top */
+       str             r0, [sp, #-4]!                  /* Save the xcp address 
at SP-4 then update SP */
+       mov             r4, sp                          /* Save the SP in a 
preserved register */
+       bic             sp, sp, #7                      /* Force 8-byte 
alignment */
+       bl              arm_syscall                     /* Call the handler */
+       ldr             sp, [r4]                        /* Restore the user 
stack pointer */
+#else
+       /* Call arm_syscall() on the user stack */
+
        mov             r4, sp                          /* Save the SP in a 
preserved register */
        bic             sp, sp, #7                      /* Force 8-byte 
alignment */
        bl              arm_syscall                     /* Call the handler */
        mov             sp, r4                          /* Restore the possibly 
unaligned stack pointer */
+#endif
 
        /* Upon return from arm_syscall, r0 holds the pointer to the register
         * state save area to use to restore the registers.  This may or may not
diff --git a/arch/arm/src/armv7-r/arm_vectors.S 
b/arch/arm/src/armv7-r/arm_vectors.S
index d4865b0..64d1190 100644
--- a/arch/arm/src/armv7-r/arm_vectors.S
+++ b/arch/arm/src/armv7-r/arm_vectors.S
@@ -297,10 +297,24 @@ arm_vectorsvc:
 
        mov             fp, #0                          /* Init frame pointer */
        mov             r0, sp                          /* Get r0=xcp */
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 7
+       /* Call arm_syscall() on the interrupt stack */
+
+       ldr             sp, .Lirqstacktop               /* SP = interrupt stack 
top */
+       str             r0, [sp, #-4]!                  /* Save the xcp address 
at SP-4 then update SP */
+       mov             r4, sp                          /* Save the SP in a 
preserved register */
+       bic             sp, sp, #7                      /* Force 8-byte 
alignment */
+       bl              arm_syscall                     /* Call the handler */
+       ldr             sp, [r4]                        /* Restore the user 
stack pointer */
+#else
+       /* Call arm_syscall() on the user stack */
+
        mov             r4, sp                          /* Save the SP in a 
preserved register */
        bic             sp, sp, #7                      /* Force 8-byte 
alignment */
        bl              arm_syscall                     /* Call the handler */
        mov             sp, r4                          /* Restore the possibly 
unaligned stack pointer */
+#endif
 
        /* Upon return from arm_syscall, r0 holds the pointer to the register
         * state save area to use to restore the registers.  This may or may not

Reply via email to