aboutsummaryrefslogtreecommitdiff
path: root/kernel/inc
diff options
context:
space:
mode:
authorMarvin Borner2021-04-03 14:04:23 +0200
committerMarvin Borner2021-04-03 14:04:23 +0200
commit394ee169ea6eb4dd5c8fa778d1c2769e26e52f01 (patch)
tree70440fb0d9eeb09e1aeec7eba6f2319d34b4918c /kernel/inc
parentce98400f8a9ebd4e62e76b9e292b7598d0d66cc0 (diff)
Enabled SMAP/SMEP protections
Diffstat (limited to 'kernel/inc')
-rw-r--r--kernel/inc/cpu.h31
1 files changed, 28 insertions, 3 deletions
diff --git a/kernel/inc/cpu.h b/kernel/inc/cpu.h
index a88d94e..e7a5f58 100644
--- a/kernel/inc/cpu.h
+++ b/kernel/inc/cpu.h
@@ -32,10 +32,27 @@ void cr3_set(u32 cr3);
u32 cr4_get(void);
void cr4_set(u32 cr4);
+void clac(void);
+void stac(void);
+
void cli(void);
void sti(void);
-enum cpuid_requests { CPUID_VENDOR_STRING, CPUID_FEATURES, CPUID_TLB, CPUID_SERIAL };
+struct cpuid {
+ u32 eax;
+ u32 ebx;
+ u32 ecx;
+ u32 edx;
+};
+
+enum cpuid_requests {
+ CPUID_VENDOR_STRING,
+ CPUID_FEATURES,
+ CPUID_TLB,
+ CPUID_SERIAL,
+ CPUID_EXT_FEATURES = 7,
+};
+
enum cpuid_features {
CPUID_FEAT_ECX_SSE3 = 1u << 0,
CPUID_FEAT_ECX_PCLMUL = 1u << 1,
@@ -95,9 +112,17 @@ enum cpuid_features {
CPUID_FEAT_EDX_HTT = 1u << 28,
CPUID_FEAT_EDX_TM1 = 1u << 29,
CPUID_FEAT_EDX_IA64 = 1u << 30,
+
+ CPUID_EXT_FEAT_EBX_UMIP = 1u << 2,
+ CPUID_EXT_FEAT_EBX_SMEP = 1u << 7,
+ CPUID_EXT_FEAT_EBX_RDSEED = 1u << 18,
+ CPUID_EXT_FEAT_EBX_SMAP = 1u << 20,
+
+ CPUID_EXT_INFO_EDX_NX = 1u << 20,
};
-u8 cpu_has_cfeature(enum cpuid_features feature);
-u8 cpu_has_dfeature(enum cpuid_features feature);
+extern struct cpuid cpu_features;
+extern struct cpuid cpu_extended_information;
+extern struct cpuid cpu_extended_features;
#endif