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

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

commit 4d1bb20f8c0edb01fd02b63bb5d22967060724c4
Author: Abdelatif Guettouche <abdelatif.guettou...@espressif.com>
AuthorDate: Sat Mar 12 23:10:22 2022 +0100

    xtensa_user_handler.S: In syscall handler store context before
    continuing the rest of the syscall handling.
    
    Signed-off-by: Abdelatif Guettouche <abdelatif.guettou...@espressif.com>
---
 arch/xtensa/src/common/xtensa_user_handler.S | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/arch/xtensa/src/common/xtensa_user_handler.S 
b/arch/xtensa/src/common/xtensa_user_handler.S
index ae8e3da..4e2eda5 100644
--- a/arch/xtensa/src/common/xtensa_user_handler.S
+++ b/arch/xtensa/src/common/xtensa_user_handler.S
@@ -338,16 +338,16 @@ _xtensa_syscall_handler:
        rsr             a0, EXCSAVE_1                                   /* Save 
interruptee's a0 */
        s32i    a0, sp, (4 * REG_A0)
 
-       /* Save EPC */
-
-#if XCHAL_HAVE_LOOPS != 0
-       /* Save A2 and A3 now to give us some registers to work with.  A0, A2
-        * and A3 are now available.
-        */
-
        s32i    a2, sp, (4 * REG_A2)                    /* Save interruptee's 
A2 */
        s32i    a3, sp, (4 * REG_A3)                    /* Save interruptee's 
A3 */
 
+       /* Save rest of interrupt context. */
+
+       call0   _xtensa_context_save
+
+       /* Save EPC */
+
+#if XCHAL_HAVE_LOOPS != 0
        /* Get the interruptee's PC and skip over the 'syscall' instruction.
         * If it's at the end of a zero-overhead loop and it's not on the last
         * iteration, decrement loop counter and skip to beginning of loop.
@@ -378,15 +378,8 @@ _xtensa_syscall_handler:
 
        wsr             a0, EPC_1                                               
/* Update PC */
        s32i    a0, sp, (4 * REG_PC)
-
-       s32i    a2, sp, (4 * REG_A2)                    /* Save interruptee's 
A2 */
-       s32i    a3, sp, (4 * REG_A3)                    /* Save interruptee's 
A3 */
 #endif
 
-       /* Save rest of interrupt context. */
-
-       call0   _xtensa_context_save                    /* Save full register 
state */
-
        /* Dispatch the sycall as with other interrupts. */
 
        mov             a12, sp                                                 
/* a12 = address of register save area */

Reply via email to