summaryrefslogtreecommitdiffstats
path: root/src/asm.h
diff options
context:
space:
mode:
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);
}