diff mbox

[kvm-unit-tests,v2,3/8] Introduce memory barriers.

Message ID 20100831083706.10672.49492.stgit@FreeLancer (mailing list archive)
State New, archived
Headers show

Commit Message

Jason Wang Aug. 31, 2010, 8:37 a.m. UTC
None
diff mbox

Patch

diff --git a/lib/x86/smp.h b/lib/x86/smp.h
index c2e7350..df5fdba 100644
--- a/lib/x86/smp.h
+++ b/lib/x86/smp.h
@@ -1,6 +1,10 @@ 
 #ifndef __SMP_H
 #define __SMP_H
 
+#define mb() 	asm volatile("mfence":::"memory")
+#define rmb()	asm volatile("lfence":::"memory")
+#define wmb()	asm volatile("sfence" ::: "memory")
+
 struct spinlock {
     int v;
 };