mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:37:43 +00:00
Kernel: Add support for hypervisor CPUID feature
This commit is contained in:
parent
bee75c1f24
commit
4cc346fb19
2 changed files with 5 additions and 0 deletions
|
@ -54,6 +54,7 @@ enum class CPUFeature : u32 {
|
||||||
AVX = (1 << 22),
|
AVX = (1 << 22),
|
||||||
FXSR = (1 << 23),
|
FXSR = (1 << 23),
|
||||||
LM = (1 << 24),
|
LM = (1 << 24),
|
||||||
|
HYPERVISOR = (1 << 25),
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,6 +93,8 @@ UNMAP_AFTER_INIT void Processor::cpu_detect()
|
||||||
set_feature(CPUFeature::AVX);
|
set_feature(CPUFeature::AVX);
|
||||||
if (processor_info.ecx() & (1 << 30))
|
if (processor_info.ecx() & (1 << 30))
|
||||||
set_feature(CPUFeature::RDRAND);
|
set_feature(CPUFeature::RDRAND);
|
||||||
|
if (processor_info.ecx() & (1u << 31))
|
||||||
|
set_feature(CPUFeature::HYPERVISOR);
|
||||||
if (processor_info.edx() & (1 << 11)) {
|
if (processor_info.edx() & (1 << 11)) {
|
||||||
u32 stepping = processor_info.eax() & 0xf;
|
u32 stepping = processor_info.eax() & 0xf;
|
||||||
u32 model = (processor_info.eax() >> 4) & 0xf;
|
u32 model = (processor_info.eax() >> 4) & 0xf;
|
||||||
|
@ -266,6 +268,8 @@ String Processor::features_string() const
|
||||||
return "avx";
|
return "avx";
|
||||||
case CPUFeature::LM:
|
case CPUFeature::LM:
|
||||||
return "lm";
|
return "lm";
|
||||||
|
case CPUFeature::HYPERVISOR:
|
||||||
|
return "hypervisor";
|
||||||
// no default statement here intentionally so that we get
|
// no default statement here intentionally so that we get
|
||||||
// a warning if a new feature is forgotten to be added here
|
// a warning if a new feature is forgotten to be added here
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue