anchao commented on a change in pull request #5896:
URL: https://github.com/apache/incubator-nuttx/pull/5896#discussion_r837134026



##########
File path: arch/arm/src/arm/arm_vectors.S
##########
@@ -136,12 +136,23 @@ arm_vectorirq:
        mov     sp, r4                          /* Restore the possibly 
unaligned stack pointer */
 #endif
 
+       /* Switch back IRQ mode and return with shadow SPSR */
+
+       mov     r4, #(PSR_MODE_IRQ | PSR_I_BIT)
+       msr     cpsr_c, r4              /* Switch back IRQ mode */
+
        /* Restore the CPSR, SYS mode registers and return */
 
        ldr     r0, [sp, #(4*REG_CPSR)] /* Fetch the return SPSR */
        msr     spsr_cxsf, r0           /* Set the return mode SPSR */
 
-       ldmia   sp, {r0-r15}^           /* Return */
+       /* Life is simple when everything is IRQ mode */
+
+       mov     r14, sp                 /* (IRQ) r14=Register storage area */
+       ldmia   r14!, {r0-r12}          /* Restore common r0-r12 */
+       ldmia   r14, {r13, r14}^        /* Restore user mode r13/r14 */
+       add     r14, r14, #(4*2)        /* (IRQ) r14=address of r15 storage */
+       ldmia   r14, {r15}^             /* Return */

Review comment:
       > ldmia sp, {r0-r12,r15}^
   
   reglist of xcp context is different with restore order.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to