mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 14:37:45 +00:00
Kernel: Support all AMD-defined CPUID feature flags for EAX=80000001h
We're now able to detect all the AMD-defined CPUID feature flags from ECX/EDX for EAX=80000001h :^)
This commit is contained in:
parent
96e6420d8d
commit
1e82c2708d
3 changed files with 167 additions and 6 deletions
|
@ -295,14 +295,77 @@ StringView cpu_feature_to_string_view(CPUFeature::Type const& feature)
|
|||
return "ia32_code_capabilities"sv;
|
||||
if (feature == CPUFeature::SSBD)
|
||||
return "ssbd"sv;
|
||||
if (feature == CPUFeature::LAHF_LM)
|
||||
return "lahf_lm"sv;
|
||||
if (feature == CPUFeature::CMP_LEGACY)
|
||||
return "cmp_legacy"sv;
|
||||
if (feature == CPUFeature::SVM)
|
||||
return "svm"sv;
|
||||
if (feature == CPUFeature::EXTAPIC)
|
||||
return "extapic"sv;
|
||||
if (feature == CPUFeature::CR8_LEGACY)
|
||||
return "cr8_legacy"sv;
|
||||
if (feature == CPUFeature::ABM)
|
||||
return "abm"sv;
|
||||
if (feature == CPUFeature::SSE4A)
|
||||
return "sse4a"sv;
|
||||
if (feature == CPUFeature::MISALIGNSSE)
|
||||
return "misalignsse"sv;
|
||||
if (feature == CPUFeature::_3DNOWPREFETCH)
|
||||
return "3dnowprefetch"sv;
|
||||
if (feature == CPUFeature::OSVW)
|
||||
return "osvw"sv;
|
||||
if (feature == CPUFeature::IBS)
|
||||
return "ibs"sv;
|
||||
if (feature == CPUFeature::XOP)
|
||||
return "xop"sv;
|
||||
if (feature == CPUFeature::SKINIT)
|
||||
return "skinit"sv;
|
||||
if (feature == CPUFeature::WDT)
|
||||
return "wdt"sv;
|
||||
if (feature == CPUFeature::LWP)
|
||||
return "lwp"sv;
|
||||
if (feature == CPUFeature::FMA4)
|
||||
return "fma4"sv;
|
||||
if (feature == CPUFeature::TCE)
|
||||
return "tce"sv;
|
||||
if (feature == CPUFeature::NODEID_MSR)
|
||||
return "nodeid_msr"sv;
|
||||
if (feature == CPUFeature::TBM)
|
||||
return "tbm"sv;
|
||||
if (feature == CPUFeature::TOPOEXT)
|
||||
return "topoext"sv;
|
||||
if (feature == CPUFeature::PERFCTR_CORE)
|
||||
return "perfctr_core"sv;
|
||||
if (feature == CPUFeature::PERFCTR_NB)
|
||||
return "perfctr_nb"sv;
|
||||
if (feature == CPUFeature::DBX)
|
||||
return "dbx"sv;
|
||||
if (feature == CPUFeature::PERFTSC)
|
||||
return "perftsc"sv;
|
||||
// NOTE: This is called perfctr_l2 on Linux, but PCX_L2I in the AMD manual & other references.
|
||||
if (feature == CPUFeature::PCX_L2I)
|
||||
return "pcx_l2i"sv;
|
||||
if (feature == CPUFeature::SYSCALL)
|
||||
return "syscall"sv;
|
||||
if (feature == CPUFeature::MP)
|
||||
return "mp"sv;
|
||||
if (feature == CPUFeature::NX)
|
||||
return "nx"sv;
|
||||
if (feature == CPUFeature::MMXEXT)
|
||||
return "mmxext"sv;
|
||||
if (feature == CPUFeature::FXSR_OPT)
|
||||
return "fxsr_opt"sv;
|
||||
if (feature == CPUFeature::PDPE1GB)
|
||||
return "pdpe1gb"sv;
|
||||
if (feature == CPUFeature::RDTSCP)
|
||||
return "rdtscp"sv;
|
||||
if (feature == CPUFeature::LM)
|
||||
return "lm"sv;
|
||||
if (feature == CPUFeature::_3DNOWEXT)
|
||||
return "3dnowext"sv;
|
||||
if (feature == CPUFeature::_3DNOW)
|
||||
return "3dnow"sv;
|
||||
if (feature == CPUFeature::CONSTANT_TSC)
|
||||
return "constant_tsc"sv;
|
||||
if (feature == CPUFeature::NONSTOP_TSC)
|
||||
|
|
|
@ -380,14 +380,80 @@ UNMAP_AFTER_INIT void Processor::cpu_detect()
|
|||
|
||||
if (max_extended_leaf >= 0x80000001) {
|
||||
CPUID extended_processor_info(0x80000001);
|
||||
|
||||
if (extended_processor_info.ecx() & (1 << 0))
|
||||
m_features |= CPUFeature::LAHF_LM;
|
||||
if (extended_processor_info.ecx() & (1 << 1))
|
||||
m_features |= CPUFeature::CMP_LEGACY;
|
||||
if (extended_processor_info.ecx() & (1 << 2))
|
||||
m_features |= CPUFeature::SVM;
|
||||
if (extended_processor_info.ecx() & (1 << 3))
|
||||
m_features |= CPUFeature::EXTAPIC;
|
||||
if (extended_processor_info.ecx() & (1 << 4))
|
||||
m_features |= CPUFeature::CR8_LEGACY;
|
||||
if (extended_processor_info.ecx() & (1 << 5))
|
||||
m_features |= CPUFeature::ABM;
|
||||
if (extended_processor_info.ecx() & (1 << 6))
|
||||
m_features |= CPUFeature::SSE4A;
|
||||
if (extended_processor_info.ecx() & (1 << 7))
|
||||
m_features |= CPUFeature::MISALIGNSSE;
|
||||
if (extended_processor_info.ecx() & (1 << 8))
|
||||
m_features |= CPUFeature::_3DNOWPREFETCH;
|
||||
if (extended_processor_info.ecx() & (1 << 9))
|
||||
m_features |= CPUFeature::OSVW;
|
||||
if (extended_processor_info.ecx() & (1 << 10))
|
||||
m_features |= CPUFeature::IBS;
|
||||
if (extended_processor_info.ecx() & (1 << 11))
|
||||
m_features |= CPUFeature::XOP;
|
||||
if (extended_processor_info.ecx() & (1 << 12))
|
||||
m_features |= CPUFeature::SKINIT;
|
||||
if (extended_processor_info.ecx() & (1 << 13))
|
||||
m_features |= CPUFeature::WDT;
|
||||
if (extended_processor_info.ecx() & (1 << 15))
|
||||
m_features |= CPUFeature::LWP;
|
||||
if (extended_processor_info.ecx() & (1 << 16))
|
||||
m_features |= CPUFeature::FMA4;
|
||||
if (extended_processor_info.ecx() & (1 << 17))
|
||||
m_features |= CPUFeature::TCE;
|
||||
if (extended_processor_info.ecx() & (1 << 19))
|
||||
m_features |= CPUFeature::NODEID_MSR;
|
||||
if (extended_processor_info.ecx() & (1 << 21))
|
||||
m_features |= CPUFeature::TBM;
|
||||
if (extended_processor_info.ecx() & (1 << 22))
|
||||
m_features |= CPUFeature::TOPOEXT;
|
||||
if (extended_processor_info.ecx() & (1 << 23))
|
||||
m_features |= CPUFeature::PERFCTR_CORE;
|
||||
if (extended_processor_info.ecx() & (1 << 24))
|
||||
m_features |= CPUFeature::PERFCTR_NB;
|
||||
if (extended_processor_info.ecx() & (1 << 26))
|
||||
m_features |= CPUFeature::DBX;
|
||||
if (extended_processor_info.ecx() & (1 << 27))
|
||||
m_features |= CPUFeature::PERFTSC;
|
||||
if (extended_processor_info.ecx() & (1 << 28))
|
||||
m_features |= CPUFeature::PCX_L2I;
|
||||
|
||||
if (extended_processor_info.edx() & (1 << 11))
|
||||
m_features |= CPUFeature::SYSCALL; // Only available in 64 bit mode
|
||||
if (extended_processor_info.edx() & (1 << 19))
|
||||
m_features |= CPUFeature::MP;
|
||||
if (extended_processor_info.edx() & (1 << 20))
|
||||
m_features |= CPUFeature::NX;
|
||||
if (extended_processor_info.edx() & (1 << 22))
|
||||
m_features |= CPUFeature::MMXEXT;
|
||||
if (extended_processor_info.edx() & (1 << 23))
|
||||
m_features |= CPUFeature::RDTSCP;
|
||||
if (extended_processor_info.edx() & (1 << 25))
|
||||
m_features |= CPUFeature::FXSR_OPT;
|
||||
if (extended_processor_info.edx() & (1 << 26))
|
||||
m_features |= CPUFeature::PDPE1GB;
|
||||
if (extended_processor_info.edx() & (1 << 27))
|
||||
m_features |= CPUFeature::RDTSCP;
|
||||
if (extended_processor_info.edx() & (1 << 29))
|
||||
m_features |= CPUFeature::LM;
|
||||
if (extended_processor_info.edx() & (1 << 30))
|
||||
m_features |= CPUFeature::_3DNOWEXT;
|
||||
if (extended_processor_info.edx() & (1 << 31))
|
||||
m_features |= CPUFeature::_3DNOW;
|
||||
}
|
||||
|
||||
if (max_extended_leaf >= 0x80000007) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue