[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86: Fix atomic_write*() macros to correctly inform GCC that memory



# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1294481155 0
# Node ID 533d6e5c0099ede05f6db7c505b3599d9d5b35a8
# Parent  c7c1ab13d08e3418b7044d31d06677b635aee047
x86: Fix atomic_write*() macros to correctly inform GCC that memory
it knows about is being written to.

The bug is a copy-and-paste error from inline asm that writes to I/O
memory. In that case, as with asm for accessign guest memory,
specifying memory as a read-only parameter is acceptable because the
memory cannot alias with anything that GCC reads directly.

Signed-off-by: Keir Fraser <keir@xxxxxxx>
---
 xen/include/asm-x86/atomic.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff -r c7c1ab13d08e -r 533d6e5c0099 xen/include/asm-x86/atomic.h
--- a/xen/include/asm-x86/atomic.h      Sat Jan 08 09:29:11 2011 +0000
+++ b/xen/include/asm-x86/atomic.h      Sat Jan 08 10:05:55 2011 +0000
@@ -11,8 +11,8 @@ static inline type name(const volatile t
 
 #define build_atomic_write(name, size, type, reg, barrier) \
 static inline void name(volatile type *addr, type val) \
-{ asm volatile("mov" size " %0,%1": :reg (val), \
-"m" (*(volatile type *)addr) barrier); }
+{ asm volatile("mov" size " %1,%0": "=m" (*(volatile type *)addr) \
+:reg (val) barrier); }
 
 build_atomic_read(atomic_read8, "b", uint8_t, "=q", )
 build_atomic_read(atomic_read16, "w", uint16_t, "=r", )

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.