summaryrefslogtreecommitdiff
path: root/hw/xfree86/common/compiler.h
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2009-08-31 15:52:39 -0400
committerMatt Turner <mattst88@gmail.com>2009-08-31 15:52:39 -0400
commit52aa0495218dc7821a23b045b2c74b2a66e34616 (patch)
tree48f94f7ba05665deb78bf7d7f27ff6cb4410edb7 /hw/xfree86/common/compiler.h
parent563fa1c5d762173cd6fb78f9e33cb960ef3153bb (diff)
Replace 8 nops with proper sync instruction on mips
Cc: Ralf Baechle <ralf@linux-mips.org> Acked-by: David Daney <ddaney@caviumnetworks.com> Signed-off-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'hw/xfree86/common/compiler.h')
-rw-r--r--hw/xfree86/common/compiler.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 114c81215..3b648df15 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__