X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=urcu%2Farch%2Fppc.h;fp=urcu%2Farch%2Fppc.h;h=a03d688837344f0bb2d438c7161d43dcb208a5ef;hp=d7317bb327c72afa48f087f50251cbe311a2ff62;hb=9a9d403acee72d36d17988ae5a6ce9ede8051f11;hpb=94aec12284c03da90d879b4d55280f9cbf0e183a diff --git a/urcu/arch/ppc.h b/urcu/arch/ppc.h index d7317bb..a03d688 100644 --- a/urcu/arch/ppc.h +++ b/urcu/arch/ppc.h @@ -48,11 +48,24 @@ extern "C" { rval; \ }) +#define mftb() \ + ({ \ + unsigned long long rval; \ + asm volatile("mftb %0" : "=r" (rval)); \ + rval; \ + }) + typedef unsigned long long cycles_t; -static inline cycles_t caa_get_cycles (void) +#ifdef __powerpc64__ +static inline cycles_t caa_get_cycles(void) { - long h, l; + return (cycles_t) mftb(); +} +#else +static inline cycles_t caa_get_cycles(void) +{ + unsigned long h, l; for (;;) { h = mftbu(); @@ -63,6 +76,7 @@ static inline cycles_t caa_get_cycles (void) return (((cycles_t) h) << 32) + l; } } +#endif #ifdef __cplusplus }