From 8dc6462e70009c0bbcf0bbfcfd2d4494d3772580 Mon Sep 17 00:00:00 2001 From: Louis Burda Date: Tue, 26 Jul 2022 17:16:10 +0200 Subject: Single eviction test with sleep --- src/asm.h | 46 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 12 deletions(-) (limited to 'src/asm.h') diff --git a/src/asm.h b/src/asm.h index 14c6593..3498f2c 100755 --- a/src/asm.h +++ b/src/asm.h @@ -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); } -- cgit v1.2.3-71-gd317