arch/arm/src/arm/up_fullcontextrestore.S: When performing stability test, the application would cause kernel crash. When I trace the stack, I find that register R1 has been changed, and its value is the same as register CPSR. In p_fullcontextrestore.S, the restoration of R0 and R1 is not atomic: 'msr cpsr r1 will enable interrupts and the recovery of r0 and r1 may be interrupted and the value or R1 may be changed. Fix is to use a single ldmia to restore R0, R1, and return via R15.
This commit is contained in:
parent
ce8fb54d07
commit
0ad5bc50fb
@ -103,16 +103,10 @@ up_fullcontextrestore:
|
||||
ldr r1, [r0, #(4*REG_CPSR)] /* Fetch the stored CPSR value */
|
||||
msr cpsr, r1 /* Set the CPSR */
|
||||
|
||||
/* Now recover r0 and r1 */
|
||||
|
||||
ldr r0, [sp]
|
||||
ldr r1, [sp, #4]
|
||||
add sp, sp, #(2*4)
|
||||
|
||||
/* Then return to the address at the stop of the stack,
|
||||
* destroying the stack frame
|
||||
/* Now recover r0 and r1. Then return to the address at the stop of
|
||||
* the stack, destroying the stack frame
|
||||
*/
|
||||
|
||||
ldr pc, [sp], #4
|
||||
ldmia sp!, {r0-r1, r15}
|
||||
.size up_fullcontextrestore, . - up_fullcontextrestore
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user