diff options
| author | Louis Burda <quent.burda@gmail.com> | 2022-08-08 19:21:29 +0200 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2022-08-08 19:21:46 +0200 |
| commit | d8a20a54b05e2c9adb5198b1439608391450dd0b (patch) | |
| tree | b6c1e472df9ceb5923d0aee4d77443b942023f62 /src/asm.h | |
| parent | 576e8dc70825a04af3ac9890491d348959bf19ce (diff) | |
| download | cachepc-d8a20a54b05e2c9adb5198b1439608391450dd0b.tar.gz cachepc-d8a20a54b05e2c9adb5198b1439608391450dd0b.zip | |
Added ioctl interface and debuged single access evictions
Diffstat (limited to 'src/asm.h')
| -rwxr-xr-x | src/asm.h | 26 |
1 files changed, 9 insertions, 17 deletions
@@ -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); -} |
