X-Git-Url: http://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=urcu%2Farch%2Fx86.h;h=aac8ca1384b63f4ce321680cffbcaca661a0f16c;hp=ccc4ce8aab5235a9c6209867d3e99c15f62c1fc0;hb=2af1c19e6a553878fcb2a5106f050d5ed7ac0f54;hpb=2c81778bd92008e5c79173788738f1800cd42e8b diff --git a/urcu/arch/x86.h b/urcu/arch/x86.h index ccc4ce8..aac8ca1 100644 --- a/urcu/arch/x86.h +++ b/urcu/arch/x86.h @@ -24,10 +24,12 @@ #include #include +#include +#include #ifdef __cplusplus extern "C" { -#endif +#endif #define CAA_CACHE_LINE_SIZE 128 @@ -68,6 +70,8 @@ extern "C" { #define caa_cpu_relax() __asm__ __volatile__ ("rep; nop" : : : "memory") +#define HAS_CAA_GET_CYCLES + #define rdtscll(val) \ do { \ unsigned int __a, __d; \ @@ -76,17 +80,29 @@ extern "C" { | (((unsigned long long)__d) << 32); \ } while(0) -typedef unsigned long long cycles_t; +typedef uint64_t caa_cycles_t; -static inline cycles_t caa_get_cycles(void) +static inline caa_cycles_t caa_get_cycles(void) { - cycles_t ret = 0; + caa_cycles_t ret = 0; rdtscll(ret); return ret; } -#ifdef __cplusplus +/* + * On Linux, define the membarrier system call number if not yet available in + * the system headers. + */ +#if (defined(__linux__) && !defined(__NR_membarrier)) +#if (CAA_BITS_PER_LONG == 32) +#define __NR_membarrier 375 +#else +#define __NR_membarrier 324 +#endif +#endif + +#ifdef __cplusplus } #endif