arm: fix enable interrupt too earlier caused system crash

reason:
	msr	cpsr, r2   /* Set the CPSR */

    // interrupt hanppend, context switch

	pop	{r0-r2, pc}

resolve:
    use SPSR instead, and recover with ldmia ^

Change-Id: Id7cee6452997ec19919eeecf6e7616164b3a0ab3
Signed-off-by: ligd <liguiding1@xiaomi.com>
(cherry picked from commit 6fa6c1676932d7babb7ff22ef556a17bb18f1c0d)
Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd 2021-06-03 15:30:32 +08:00 committed by Xiang Xiao
parent 5de150160f
commit 50eee2f081
2 changed files with 6 additions and 6 deletions

View File

@ -87,11 +87,11 @@ arm_fullcontextrestore:
*/
ldr r1, [r0, #(4*REG_CPSR)] /* Fetch the stored CPSR value */
msr cpsr, r1 /* Set the CPSR */
msr spsr, r1 /* Set the SPSR */
/* Now recover r0-r1 and pc, destroying the stack frame */
/* Now recover r0-r1, pc and cpsr, destroying the stack frame */
ldmia sp!, {r0-r1, r15}
ldmia sp!, {r0-r1, r15}^
.size arm_fullcontextrestore, .-arm_fullcontextrestore
.end

View File

@ -144,11 +144,11 @@ arm_fullcontextrestore:
* disabled.
*/
msr cpsr, r2 /* Set the CPSR */
msr spsr, r2 /* Set the SPSR */
/* Now recover r0 r1 r2 and R15 */
/* Now recover r0-r2, pc and cpsr, destroying the stack frame */
pop {r0-r2, pc}
ldmia sp!, {r0-r2, pc}^
#endif
.size arm_fullcontextrestore, .-arm_fullcontextrestore