diff options
Diffstat (limited to 'src/asm.h')
| -rwxr-xr-x | src/asm.h | 46 |
1 files changed, 34 insertions, 12 deletions
@@ -19,6 +19,12 @@ static inline void cachepc_sfence(void); __attribute__((always_inline)) static inline void cachepc_mfence(void); +__attribute__((always_inline)) +static inline void cachepc_readq(void *p); + +__attribute__((always_inline)) +static inline void cachepc_victim(void *p); + uint64_t cachepc_readpmc(uint64_t event) { @@ -46,26 +52,42 @@ cachepc_cpuid(void) void cachepc_lfence(void) { - asm volatile( - "lfence\n\t" - :: - ); + asm volatile( + "lfence\n\t" + :: + ); } void cachepc_sfence(void) { - asm volatile( - "sfence\n\t" - :: - ); + asm volatile( + "sfence\n\t" + :: + ); } void cachepc_mfence(void) { - asm volatile( - "mfence\n\t" - :: - ); + asm volatile( + "mfence\n\t" + :: + ); +} + +void +cachepc_readq(void *p) +{ + asm volatile ( + "movq (%0), %%r10\n\t" + : : "r" (p) : "r10" + ); +} + +void +cachepc_victim(void *p) +{ + cachepc_mfence(); + cachepc_readq(p); } |
