X-Git-Url: http://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=arch_x86.h;h=8a5732536c9d3106af919b5467dab1f58c5f9313;hp=4a2573e0f52934e3a2635516ad5f66cfd7c5c563;hb=ba59a0c7b244a0939a2298fc76a9002436ef9674;hpb=92d1c6565b8cd5c385853a6e1b4ca54184d9d4ac diff --git a/arch_x86.h b/arch_x86.h index 4a2573e..8a57325 100644 --- a/arch_x86.h +++ b/arch_x86.h @@ -94,6 +94,26 @@ static inline void cpu_relax(void) rep_nop(); } +/* + * Serialize core instruction execution. Also acts as a compiler barrier. + */ +#ifdef __PIC__ +/* + * Cannot use cpuid because it clobbers the ebx register and clashes + * with -fPIC : + * error: PIC register 'ebx' clobbered in 'asm' + */ +static inline void sync_core(void) +{ + mb(); +} +#else +static inline void sync_core(void) +{ + asm volatile("cpuid" : : : "memory", "eax", "ebx", "ecx", "edx"); +} +#endif + #define rdtscll(val) \ do { \ unsigned int __a, __d; \