diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/drivers/cpu.c | 7 | ||||
-rw-r--r-- | kernel/inc/cpu.h | 52 |
2 files changed, 58 insertions, 1 deletions
diff --git a/kernel/drivers/cpu.c b/kernel/drivers/cpu.c index f751d33..5d53bef 100644 --- a/kernel/drivers/cpu.c +++ b/kernel/drivers/cpu.c @@ -168,6 +168,13 @@ CLEAR void cpu_enable_features(void) } else { print("No SMAP support :(\n"); } + + // Enable UMIP // TODO: QEMU support?! + if (cpu_extended_features.ecx & CPUID_EXT_FEAT_ECX_UMIP) { + cr4_set(cr4_get() | 0x800); + } else { + print("No UMIP support :(\n"); + } } void clac(void) diff --git a/kernel/inc/cpu.h b/kernel/inc/cpu.h index e7a5f58..7ac6074 100644 --- a/kernel/inc/cpu.h +++ b/kernel/inc/cpu.h @@ -113,10 +113,60 @@ enum cpuid_features { CPUID_FEAT_EDX_TM1 = 1u << 29, CPUID_FEAT_EDX_IA64 = 1u << 30, - CPUID_EXT_FEAT_EBX_UMIP = 1u << 2, + CPUID_EXT_FEAT_EBX_FSGSBASE = 1u << 0, + CPUID_EXT_FEAT_EBX_SGX = 1u << 2, + CPUID_EXT_FEAT_EBX_BMI1 = 1u << 3, + CPUID_EXT_FEAT_EBX_HLE = 1u << 4, + CPUID_EXT_FEAT_EBX_AVX2 = 1u << 5, CPUID_EXT_FEAT_EBX_SMEP = 1u << 7, + CPUID_EXT_FEAT_EBX_BMI2 = 1u << 8, + CPUID_EXT_FEAT_EBX_ERMS = 1u << 9, + CPUID_EXT_FEAT_EBX_INVPCID = 1u << 10, + CPUID_EXT_FEAT_EBX_RTM = 1u << 11, + CPUID_EXT_FEAT_EBX_PQM = 1u << 12, + CPUID_EXT_FEAT_EBX_MPX = 1u << 14, + CPUID_EXT_FEAT_EBX_PQE = 1u << 15, + CPUID_EXT_FEAT_EBX_AVX512F = 1u << 16, + CPUID_EXT_FEAT_EBX_AVX512DQ = 1u << 17, CPUID_EXT_FEAT_EBX_RDSEED = 1u << 18, + CPUID_EXT_FEAT_EBX_ADX = 1u << 19, CPUID_EXT_FEAT_EBX_SMAP = 1u << 20, + CPUID_EXT_FEAT_EBX_AVX512IFMA = 1u << 21, + CPUID_EXT_FEAT_EBX_PCOMMIT = 1u << 22, + CPUID_EXT_FEAT_EBX_CLFLUSHOPT = 1u << 23, + CPUID_EXT_FEAT_EBX_CLWB = 1u << 24, + CPUID_EXT_FEAT_EBX_INTELPT = 1u << 25, + CPUID_EXT_FEAT_EBX_AVX512PF = 1u << 26, + CPUID_EXT_FEAT_EBX_AVX512ER = 1u << 27, + CPUID_EXT_FEAT_EBX_AVX512CD = 1u << 28, + CPUID_EXT_FEAT_EBX_SHA = 1u << 29, + CPUID_EXT_FEAT_EBX_AVX512BW = 1u << 30, + + CPUID_EXT_FEAT_ECX_PREFETCHWT1 = 1u << 0, + CPUID_EXT_FEAT_ECX_AVX512VBMI = 1u << 1, + CPUID_EXT_FEAT_ECX_UMIP = 1u << 2, + CPUID_EXT_FEAT_ECX_PKU = 1u << 3, + CPUID_EXT_FEAT_ECX_OSPKE = 1u << 4, + CPUID_EXT_FEAT_ECX_WAITPKG = 1u << 5, + CPUID_EXT_FEAT_ECX_AVX512VBMI2 = 1u << 6, + CPUID_EXT_FEAT_ECX_CETSS = 1u << 7, + CPUID_EXT_FEAT_ECX_GFNI = 1u << 8, + CPUID_EXT_FEAT_ECX_VAES = 1u << 9, + CPUID_EXT_FEAT_ECX_VPCLMULQDQ = 1u << 10, + CPUID_EXT_FEAT_ECX_AVX512VNNI = 1u << 11, + CPUID_EXT_FEAT_ECX_AVX512BITALG = 1u << 12, + CPUID_EXT_FEAT_ECX_AVX512VPOPCNTDQ = 1u << 14, + CPUID_EXT_FEAT_ECX_MAWAU1 = 1u << 17, + CPUID_EXT_FEAT_ECX_MAWAU2 = 1u << 18, + CPUID_EXT_FEAT_ECX_MAWAU3 = 1u << 19, + CPUID_EXT_FEAT_ECX_MAWAU4 = 1u << 20, + CPUID_EXT_FEAT_ECX_MAWAU5 = 1u << 21, + CPUID_EXT_FEAT_ECX_RDPID = 1u << 22, + CPUID_EXT_FEAT_ECX_CLDEMOTE = 1u << 25, + CPUID_EXT_FEAT_ECX_MOVDIRI = 1u << 27, + CPUID_EXT_FEAT_ECX_MOVDIR64B = 1u << 28, + CPUID_EXT_FEAT_ECX_ENQCMD = 1u << 29, + CPUID_EXT_FEAT_ECX_SGXLC = 1u << 30, CPUID_EXT_INFO_EDX_NX = 1u << 20, }; |