From 729ee7c099eafd2f52c984f6d43b36f499e4224b Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 23 Dec 2016 11:13:18 -0600 Subject: [PATCH] ARMv7-A: Small improvement to some register handling in context restoration. --- arch/arm/src/armv7-a/arm_fullcontextrestore.S | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/arch/arm/src/armv7-a/arm_fullcontextrestore.S b/arch/arm/src/armv7-a/arm_fullcontextrestore.S index 91f9e0eaa70..37d484b4f47 100644 --- a/arch/arm/src/armv7-a/arm_fullcontextrestore.S +++ b/arch/arm/src/armv7-a/arm_fullcontextrestore.S @@ -145,26 +145,25 @@ up_fullcontextrestore: * assuming that it is set???). */ - sub sp, sp, #(4*9) /* Frame for nine registers */ + sub sp, sp, #(4*8) /* Frame for eight registers */ - str r0, [sp, #(4*0)] /* Save the structure pointer at the top of the stack */ ldr r1, [r0, #(4*REG_R2)] /* Fetch the stored r2 value */ - str r1, [sp, #(4*1)] /* Save it in the stack */ + str r1, [sp, #(4*0)] /* Save it in the stack */ ldr r1, [r0, #(4*REG_R3)] /* Fetch the stored r3 value */ - str r1, [sp, #(4*2)] /* Save it in the stack */ + str r1, [sp, #(4*1)] /* Save it in the stack */ ldr r1, [r0, #(4*REG_R12)] /* Fetch the stored r12 value */ - str r1, [sp, #(4*3)] /* Save it in the stack */ + str r1, [sp, #(4*2)] /* Save it in the stack */ ldr r1, [r0, #(4*REG_R14)] /* Fetch the stored r14 value */ - str r1, [sp, #(4*4)] /* Save it in the stack */ + str r1, [sp, #(4*3)] /* Save it in the stack */ ldr r1, [r0, #(4*REG_CPSR)] /* Fetch the stored CPSR value */ - str r1, [sp, #(4*5)] /* Save it in the stack */ + str r1, [sp, #(4*4)] /* Save it in the stack */ ldr r1, [r0, #(4*REG_R0)] /* Fetch the stored r0 value */ - str r1, [sp, #(4*6)] /* Save it in the stack */ + str r1, [sp, #(4*5)] /* Save it in the stack */ ldr r1, [r0, #(4*REG_R1)] /* Fetch the stored r1 value */ - str r1, [sp, #(4*7)] /* Save it in the stack */ + str r1, [sp, #(4*6)] /* Save it in the stack */ ldr r1, [r0, #(4*REG_PC)] /* Fetch the stored pc value */ - str r1, [sp, #(4*8)] /* Save it at the bottom of the frame */ + str r1, [sp, #(4*7)] /* Save it at the bottom of the frame */ /* In the SMP configuration, critical section management uses a * "voting" algorithm with current task on each CPU casting its @@ -179,13 +178,12 @@ up_fullcontextrestore: * that were saved on the stack. */ - ldr r0, [sp, #(4*0)] /* Recover the structure pointer at the top of the stack */ - ldr r2, [sp, #(4*1)] /* Recover R2 */ - ldr r3, [sp, #(4*2)] /* Recover R3 */ - ldr r12, [sp, #(4*3)] /* Recover R12 */ - ldr r14, [sp, #(4*4)] /* Recover R14 */ - ldr r1, [sp, #(4*5)] /* Recover the save CPSR in r1 */ - add sp, sp, #(4*6) /* Discard 6 of the allocated 9 storage locations */ + ldr r2, [sp, #(4*0)] /* Recover R2 */ + ldr r3, [sp, #(4*1)] /* Recover R3 */ + ldr r12, [sp, #(4*2)] /* Recover R12 */ + ldr r14, [sp, #(4*3)] /* Recover R14 */ + ldr r1, [sp, #(4*4)] /* Recover the save CPSR in r1 */ + add sp, sp, #(4*5) /* Discard 5 of the allocated 8 storage locations */ #else