linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ARM: kexec: Add missing memory clobber to inline asm in crash_setup_regs()
@ 2010-11-16 13:12 Dave Martin
  2010-11-16 13:12 ` [PATCH 2/2] ARM: kexec: Fix crash_setup_regs() for ARMv7 and CONFIG_THUMB2_KERNEL Dave Martin
  0 siblings, 1 reply; 7+ messages in thread
From: Dave Martin @ 2010-11-16 13:12 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Applies cleanly on v2.6.37-rc1.

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>
---
 arch/arm/include/asm/kexec.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/include/asm/kexec.h b/arch/arm/include/asm/kexec.h
index 8ec9ef5..b37e02c 100644
--- a/arch/arm/include/asm/kexec.h
+++ b/arch/arm/include/asm/kexec.h
@@ -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));
 	}
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-11-17 14:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-16 13:12 [PATCH 1/2] ARM: kexec: Add missing memory clobber to inline asm in crash_setup_regs() Dave Martin
2010-11-16 13:12 ` [PATCH 2/2] ARM: kexec: Fix crash_setup_regs() for ARMv7 and CONFIG_THUMB2_KERNEL Dave Martin
2010-11-17 13:11   ` Mika Westerberg
2010-11-17 13:26     ` Catalin Marinas
2010-11-17 13:35       ` Mika Westerberg
2010-11-17 13:39         ` Catalin Marinas
2010-11-17 14:01         ` Dave P. Martin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).