[PATCH 5/9] Replace 8 nops with proper sync instruction on mips

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


Cc: David Daney <ddaney at caviumnetworks.com>
Cc: Ralf Baechle <ralf at linux-mips.org>
Signed-off-by: Matt Turner <mattst88 at gmail.com>
---
 hw/xfree86/common/compiler.h |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 8ea19b3..2fc1e6a 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -165,16 +165,17 @@ extern unsigned short ldw_brx(volatile unsigned char *, int);
 #    endif
 
 #   elif defined __mips__
-#    define mem_barrier() \
-        __asm__ __volatile__(                                   \
-                "# prevent instructions being moved around\n\t" \
-                ".set\tnoreorder\n\t"                           \
-                "# 8 nops to fool the R4400 pipeline\n\t"       \
-                "nop;nop;nop;nop;nop;nop;nop;nop\n\t"           \
-                ".set\treorder"                                 \
-                : /* no output */                               \
-                : /* no input */                                \
-                : "memory")
+     /* Note: sync instruction requires MIPS II instruction set */
+#    define mem_barrier()		\
+	__asm__ __volatile__(		\
+		".set   push\n\t"	\
+		".set   noreorder\n\t"	\
+		".set   mips2\n\t"	\
+		"sync\n\t"		\
+		".set   pop"		\
+		: /* no output */	\
+		: /* no input */	\
+		: "memory")
 #    define write_mem_barrier() mem_barrier()
 
 #   elif defined __powerpc__
-- 
1.6.3.3



More information about the xorg-devel mailing list