From: Mathieu Desnoyers Date: Wed, 13 May 2009 18:03:52 +0000 (-0400) Subject: add sync_core primitive X-Git-Tag: v0.1~226 X-Git-Url: http://git.liburcu.org/?p=urcu.git;a=commitdiff_plain;h=ebb22fff4a06b0661b55726ad332c4c53f6603fe;hp=92d1c6565b8cd5c385853a6e1b4ca54184d9d4ac add sync_core primitive Add sync_core() to serialize instruction execution on a core. Signed-off-by: Mathieu Desnoyers --- diff --git a/arch_ppc.h b/arch_ppc.h index c68790f..9c4ec91 100644 --- a/arch_ppc.h +++ b/arch_ppc.h @@ -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; \ diff --git a/arch_x86.h b/arch_x86.h index 4a2573e..e7d945e 100644 --- a/arch_x86.h +++ b/arch_x86.h @@ -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; \