From d8a20a54b05e2c9adb5198b1439608391450dd0b Mon Sep 17 00:00:00 2001 From: Louis Burda Date: Mon, 8 Aug 2022 19:21:29 +0200 Subject: Added ioctl interface and debuged single access evictions --- src/asm.h | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'src/asm.h') diff --git a/src/asm.h b/src/asm.h index 101faa9..35f803b 100755 --- a/src/asm.h +++ b/src/asm.h @@ -22,21 +22,20 @@ 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) { uint32_t lo, hi; + event = 0xC0010201 + 2 * event; + asm volatile ( "rdmsr" : "=a" (lo), "=d" (hi) : "c"(event) ); - return ((uint64_t) hi << 32) | (uint64_t)lo; + return ((uint64_t) hi << 32) | (uint64_t) lo; } void @@ -54,29 +53,29 @@ cachepc_lfence(void) { asm volatile( "lfence\n\t" - :: + ::: "memory" ); } -inline void +void cachepc_sfence(void) { asm volatile( "sfence\n\t" - :: + ::: "memory" ); } -inline void +void cachepc_mfence(void) { asm volatile( "mfence\n\t" - :: + ::: "memory" ); } -inline void +void cachepc_readq(void *p) { asm volatile ( @@ -84,10 +83,3 @@ cachepc_readq(void *p) : : "r" (p) : "r10" ); } - -inline void -cachepc_victim(void *p) -{ - cachepc_mfence(); - cachepc_readq(p); -} -- cgit v1.2.3-71-gd317