Skip to content

Commit

Permalink
ARM: 6517/1: kexec: Add missing memory clobber to inline asm in crash…
Browse files Browse the repository at this point in the history
…_setup_regs()

Currently, the inline asm is passed &newregs->ARM_r0 as in input,
when modifying multiple fields of newregs.

It's plausible to assume that GCC will assume newregs->ARM_r0 is
modified when passed the address, but unfortunately this assumption
is incorrect.

Also, GCC has no way to guess that the other ARM_r* fields are
modified without the addition of a "memory" clobber.

Signed-off-by: Dave Martin <dave.martin@linaro.org>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Dave Martin authored and Russell King committed Dec 4, 2010
1 parent cb5d39b commit 0946b8c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/arm/include/asm/kexec.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static inline void crash_setup_regs(struct pt_regs *newregs,
memcpy(newregs, oldregs, sizeof(*newregs));
} else {
__asm__ __volatile__ ("stmia %0, {r0 - r15}"
: : "r" (&newregs->ARM_r0));
: : "r" (&newregs->ARM_r0) : "memory");
__asm__ __volatile__ ("mrs %0, cpsr"
: "=r" (newregs->ARM_cpsr));
}
Expand Down

0 comments on commit 0946b8c

Please sign in to comment.