From d0cf7e0fa61cad63c3f9eed124f38dd8afe481e0 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Sat, 8 Jan 2011 10:45:22 +0000 Subject: [PATCH] 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 xen-unstable changeset: 22683:533d6e5c0099 xen-unstable date: Sat Jan 08 10:05:55 2011 +0000 --- xen/include/asm-x86/atomic.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/include/asm-x86/atomic.h b/xen/include/asm-x86/atomic.h index 345880fd12..446b969e2f 100644 --- a/xen/include/asm-x86/atomic.h +++ b/xen/include/asm-x86/atomic.h @@ -17,8 +17,8 @@ static inline type name(const volatile type *addr) \ #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", ) -- 2.39.5