summaryrefslogtreecommitdiffstats
path: root/src/asm.h
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2022-07-26 17:16:10 +0200
committerLouis Burda <quent.burda@gmail.com>2022-07-26 17:16:10 +0200
commit8dc6462e70009c0bbcf0bbfcfd2d4494d3772580 (patch)
treeccec0043527663246b27ccebc598a68cb61681e7 /src/asm.h
parent2558cb66b59aae1578fc46ff8edf5d7cf9383037 (diff)
downloadcachepc-8dc6462e70009c0bbcf0bbfcfd2d4494d3772580.tar.gz
cachepc-8dc6462e70009c0bbcf0bbfcfd2d4494d3772580.zip
Single eviction test with sleep
Diffstat (limited to 'src/asm.h')
-rwxr-xr-xsrc/asm.h46
1 files changed, 34 insertions, 12 deletions
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);
}