[PATCH 3/9] Add x86 barrier macros

Matt Turner mattst88 at gmail.com
Wed Aug 12 22:45:36 PDT 2009


Signed-off-by: Matt Turner <mattst88 at gmail.com>
---
 hw/xfree86/common/compiler.h |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index a1cc1b8..ab0c79a 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -129,7 +129,21 @@ extern unsigned short ldw_brx(volatile unsigned char *, int);
 
 # ifndef NO_INLINE
 #  ifdef __GNUC__
-#   ifdef __alpha__
+#   ifdef __i386__
+
+#    ifdef __SSE__
+#     define write_mem_barrier() __asm__ __volatile__ ("sfence" : : : "memory")
+#    else
+#     define write_mem_barrier() __asm__ __volatile__ ("lock; addl $0,0(%%esp)" : : : "memory")
+#    endif
+
+#    ifdef __SSE2__
+#     define mem_barrier() __asm__ __volatile__ ("mfence" : : : "memory")
+#    else
+#     define mem_barrier() __asm__ __volatile__ ("lock; addl $0,0(%%esp)" : : : "memory")
+#    endif
+
+#   elif defined __alpha__
 
 #    define mem_barrier() __asm__ __volatile__ ("mb" : : : "memory")
 #    define write_mem_barrier() __asm__ __volatile__ ("wmb" : : : "memory")
-- 
1.6.3.3



More information about the xorg-devel mailing list