[ARM] 3256/1: Make the function-returning ldm's use sp as the base register
Patch from Catalin Marinas If the low interrupt latency mode is enabled for the CPU (from ARMv6 onwards), the ldm/stm instructions are no longer atomic. An ldm instruction restoring the sp and pc registers can be interrupted immediately after sp was updated but before the pc. If this happens, the CPU restores the base register to the value before the ldm instruction but if the base register is not sp, the interrupt routine will corrupt the stack and the restarted ldm instruction will load garbage. Note that future ARM cores might always run in the low interrupt latency mode. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
committed by
Russell King
parent
ece5f7b3c4
commit
90303b1023
@@ -101,7 +101,7 @@ void __attribute__((naked)) set_fiq_regs(struct pt_regs *regs)
|
||||
ldmia %1, {r8 - r14}\n\
|
||||
msr cpsr_c, %0 @ return to SVC mode\n\
|
||||
mov r0, r0\n\
|
||||
ldmea fp, {fp, sp, pc}"
|
||||
ldmfd sp, {fp, sp, pc}"
|
||||
: "=&r" (tmp)
|
||||
: "r" (®s->ARM_r8), "I" (PSR_I_BIT | PSR_F_BIT | FIQ_MODE));
|
||||
}
|
||||
@@ -119,7 +119,7 @@ void __attribute__((naked)) get_fiq_regs(struct pt_regs *regs)
|
||||
stmia %1, {r8 - r14}\n\
|
||||
msr cpsr_c, %0 @ return to SVC mode\n\
|
||||
mov r0, r0\n\
|
||||
ldmea fp, {fp, sp, pc}"
|
||||
ldmfd sp, {fp, sp, pc}"
|
||||
: "=&r" (tmp)
|
||||
: "r" (®s->ARM_r8), "I" (PSR_I_BIT | PSR_F_BIT | FIQ_MODE));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user