debuggers.hg

changeset 22729:533d6e5c0099

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@xen.org>
author Keir Fraser <keir@xen.org>
date Sat Jan 08 10:05:55 2011 +0000 (2011-01-08)
parents c7c1ab13d08e
children 0e49e2590462
files xen/include/asm-x86/atomic.h
line diff
     1.1 --- a/xen/include/asm-x86/atomic.h	Sat Jan 08 09:29:11 2011 +0000
     1.2 +++ b/xen/include/asm-x86/atomic.h	Sat Jan 08 10:05:55 2011 +0000
     1.3 @@ -11,8 +11,8 @@ static inline type name(const volatile t
     1.4  
     1.5  #define build_atomic_write(name, size, type, reg, barrier) \
     1.6  static inline void name(volatile type *addr, type val) \
     1.7 -{ asm volatile("mov" size " %0,%1": :reg (val), \
     1.8 -"m" (*(volatile type *)addr) barrier); }
     1.9 +{ asm volatile("mov" size " %1,%0": "=m" (*(volatile type *)addr) \
    1.10 +:reg (val) barrier); }
    1.11  
    1.12  build_atomic_read(atomic_read8, "b", uint8_t, "=q", )
    1.13  build_atomic_read(atomic_read16, "w", uint16_t, "=r", )