summaryrefslogtreecommitdiffstats
path: root/kmod/asm.h
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2022-10-05 15:05:19 +0200
committerLouis Burda <quent.burda@gmail.com>2022-10-05 15:05:19 +0200
commit58d8565f015f9e06e1e51a0fe4654b966b2c27c0 (patch)
treee862ba1491cb114be46e98022ce8feaf98f8eca2 /kmod/asm.h
parent8b1535789509812763de132f877b596d01861714 (diff)
downloadcachepc-58d8565f015f9e06e1e51a0fe4654b966b2c27c0.tar.gz
cachepc-58d8565f015f9e06e1e51a0fe4654b966b2c27c0.zip
Refactor sevstep kernel patch into repository
Diffstat (limited to 'kmod/asm.h')
-rw-r--r--kmod/asm.h66
1 files changed, 0 insertions, 66 deletions
diff --git a/kmod/asm.h b/kmod/asm.h
deleted file mode 100644
index 9e9385a..0000000
--- a/kmod/asm.h
+++ /dev/null
@@ -1,66 +0,0 @@
-#pragma once
-
-#include <linux/kernel.h>
-
-#define CPUID_AFFECTED_REGS "rax", "rbx", "rcx", "rdx"
-
-__attribute__((always_inline))
-static inline void cachepc_cpuid(void);
-
-__attribute__((always_inline))
-static inline void cachepc_lfence(void);
-
-__attribute__((always_inline))
-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);
-
-void
-cachepc_cpuid(void)
-{
- asm volatile(
- "mov $0x80000005, %%eax\n\t"
- "cpuid\n\t"
- ::: CPUID_AFFECTED_REGS
- );
-}
-
-void
-cachepc_lfence(void)
-{
- asm volatile(
- "lfence\n\t"
- ::: "memory"
- );
-}
-
-void
-cachepc_sfence(void)
-{
- asm volatile(
- "sfence\n\t"
- ::: "memory"
- );
-}
-
-void
-cachepc_mfence(void)
-{
- asm volatile(
- "mfence\n\t"
- ::: "memory"
- );
-}
-
-void
-cachepc_readq(void *p)
-{
- asm volatile (
- "movq (%0), %%r10\n\t"
- : : "r" (p) : "r10"
- );
-}