You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/09/15 17:29:07 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #7099: armv7-a/r: modify regs index to improve exception performance

xiaoxiang781216 commented on code in PR #7099:
URL: https://github.com/apache/incubator-nuttx/pull/7099#discussion_r972257539


##########
arch/arm/src/armv7-a/arm_vectors.S:
##########
@@ -768,13 +710,14 @@ arm_vectorfiq:
 
 	/* Life is simple when everything is FIQ mode */
 
-	mov		r14, r0				/* (FIQ) r14=Register storage area */
+	ldmia		r0, {r13, r14}^			/* Restore user mode r13 and r14 */
+	add		r14, r0, #8
 	ldmia		r14!, {r0-r7}			/* Restore common r0-r7 */
-	ldmia		r14, {r8-r14}^			/* Restore user mode r8-r14 */
+	ldmia		r14, {r8-r12}^			/* Restore user mode r8-r12 */

Review Comment:
   ```suggestion
   	ldmia		r14!, {r8-r12}^			/* Restore user mode r8-r12 */
   ```
   and remove line 717



##########
arch/arm/src/armv7-a/arm_vectors.S:
##########
@@ -698,62 +652,50 @@ arm_vectorfiq:
 	/* Save the LR and SPSR onto the SYS mode stack before switch. */
 
 	sub		lr, lr, #4
-	srsdb		sp, #PSR_MODE_SYS
+	srsdb		sp!, #PSR_MODE_SYS
 
 	cpsid		if, #PSR_MODE_SYS		/* Switch to SYS mode */
 
 	/* Create a context structure.  First set aside a stack frame
 	 * and store r0-r12 into the frame.
 	 */
 
-	sub		sp, sp, #XCPTCONTEXT_SIZE
-	stmia		sp, {r0-r12}			/* Save the SYS mode regs */
+	stmdb		sp!, {r0-r12}			/* Save the SYS mode regs */
 
-	/* Get the correct values of USR/SYS r13(sp) and r14(lr) in r1 and r2 */
-
-	add		r1, sp, #XCPTCONTEXT_SIZE
-	mov		r2, r14
-
-	/* Save r13(sp), r14(lr) */
+	/* Get the correct values of USR/SYS r13(sp) in r1 and
+	 * save r13 and r14 into the frame.
+	 */
 
-	add		r0, sp, #(4*REG_SP)		/* Offset to pc, cpsr storage */
-	stmia		r0, {r1-r2}
+	add		r1, sp, #(XCPTCONTEXT_SIZE-4*REG_R0)
+	stmdb		sp!, {r1, r14}
 
 #ifdef CONFIG_ARCH_FPU
 	/* Save the state of the floating point registers. */
 
-	add		r0, sp, #(4*REG_S0)		/* R1=Address of FP register storage */
-	savefpu		r0, r1
+	savefpu		sp, r1
 #endif
 
 	/* Then call the FIQ handler with interrupts disabled. */
 
 	mov		fp, #0				/* Init frame pointer */
 	mov		r0, sp				/* Get r0=xcp */
 
+	mov		r4, sp				/* Save the SP in a preserved register */
+
 #if CONFIG_ARCH_INTERRUPTSTACK > 7
 	/* Call arm_decodefiq() on the interrupt stack */
 
 	setfiqstack	r1, r4				/* SP = interrupt stack top */

Review Comment:
   ```suggestion
   	setfiqstack	r1, r3				/* SP = interrupt stack top */
   ```



-- 
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-unsubscribe@nuttx.apache.org

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