diff options
author | Jean-Baptiste Boric <jblbeurope@gmail.com> | 2021-07-11 19:08:27 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-14 13:52:34 +0200 |
commit | 4cc346fb19504f0d30128a3dbd1ff122387c8b9d (patch) | |
tree | 5bb85771bf0fb1d34a352b4d191279b16fafa072 /Kernel | |
parent | bee75c1f242172cd20e52483c69335d9576ab8bc (diff) | |
download | serenity-4cc346fb19504f0d30128a3dbd1ff122387c8b9d.zip |
Kernel: Add support for hypervisor CPUID feature
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/Arch/x86/CPUID.h | 1 | ||||
-rw-r--r-- | Kernel/Arch/x86/common/Processor.cpp | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/Kernel/Arch/x86/CPUID.h b/Kernel/Arch/x86/CPUID.h index dc130b849d..af05ee4c58 100644 --- a/Kernel/Arch/x86/CPUID.h +++ b/Kernel/Arch/x86/CPUID.h @@ -54,6 +54,7 @@ enum class CPUFeature : u32 { AVX = (1 << 22), FXSR = (1 << 23), LM = (1 << 24), + HYPERVISOR = (1 << 25), }; } diff --git a/Kernel/Arch/x86/common/Processor.cpp b/Kernel/Arch/x86/common/Processor.cpp index d6197c122a..eb0419b524 100644 --- a/Kernel/Arch/x86/common/Processor.cpp +++ b/Kernel/Arch/x86/common/Processor.cpp @@ -93,6 +93,8 @@ UNMAP_AFTER_INIT void Processor::cpu_detect() set_feature(CPUFeature::AVX); if (processor_info.ecx() & (1 << 30)) set_feature(CPUFeature::RDRAND); + if (processor_info.ecx() & (1u << 31)) + set_feature(CPUFeature::HYPERVISOR); if (processor_info.edx() & (1 << 11)) { u32 stepping = processor_info.eax() & 0xf; u32 model = (processor_info.eax() >> 4) & 0xf; @@ -266,6 +268,8 @@ String Processor::features_string() const return "avx"; case CPUFeature::LM: return "lm"; + case CPUFeature::HYPERVISOR: + return "hypervisor"; // no default statement here intentionally so that we get // a warning if a new feature is forgotten to be added here } |