add sync_core primitive
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Wed, 13 May 2009 18:03:52 +0000 (14:03 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Wed, 13 May 2009 18:03:52 +0000 (14:03 -0400)
Add sync_core() to serialize instruction execution on a core.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
arch_ppc.h
arch_x86.h

index c68790f3dc901d0a0e2cd013e1a3b73185259780..9c4ec912537b6550e5e0676ef350635fb14cc507 100644 (file)
@@ -78,6 +78,14 @@ static inline void cpu_relax(void)
        barrier();
 }
 
+/*
+ * Serialize core instruction execution. Also acts as a compiler barrier.
+ */
+static inline void sync_core()
+{
+       asm volatile("isync" : : : "memory");
+}
+
 #define mftbl()                                                \
        ({                                              \
                unsigned long rval;                     \
index 4a2573e0f52934e3a2635516ad5f66cfd7c5c563..e7d945e3859393edece5eb4b2aee4c99538083e2 100644 (file)
@@ -94,6 +94,14 @@ static inline void cpu_relax(void)
        rep_nop();
 }
 
+/*
+ * Serialize core instruction execution. Also acts as a compiler barrier.
+ */
+static inline void sync_core(void)
+{
+       asm volatile("cpuid" : : : "memory", "eax", "ebx", "ecx", "edx");
+}
+
 #define rdtscll(val)                                                     \
        do {                                                              \
             unsigned int __a, __d;                                       \
This page took 0.025939 seconds and 4 git commands to generate.