From b54421714a649a1f16fdce5c7bbf25e8179cdfef Mon Sep 17 00:00:00 2001 From: Joursoir Date: Mon, 1 May 2023 14:28:58 +0400 Subject: add extended CPU features detection --- cpui-drv.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cpui-drv.c b/cpui-drv.c index 67f6aaa..cbd283b 100644 --- a/cpui-drv.c +++ b/cpui-drv.c @@ -10,11 +10,14 @@ enum feature_information { FEATURES_7_ECX, FEATURES_7_EDX, FEATURES_7_1_EAX, + FEATURES_8000_0001_ECX, + FEATURES_8000_0001_EDX, FEATURES_LAST, }; struct cpui_info { uint32_t cpuid_max; + uint32_t ext_cpuid_max; char vendor_string[13]; uint8_t family; @@ -105,6 +108,17 @@ static void get_cpu_features(struct cpui_info *cpu) cpu->features[FEATURES_7_1_EAX] = eax; } } + + /* Get Maximum Input Value for Extended Function CPUID Information */ + cpuid(0x80000000, &eax, &ebx, &ecx, &edx); + cpu->ext_cpuid_max = eax; + + if (cpu->ext_cpuid_max >= 0x80000001) { + cpuid(0x80000001, &eax, &ebx, &ecx, &edx); + + cpu->features[FEATURES_8000_0001_ECX] = ecx; + cpu->features[FEATURES_8000_0001_EDX] = edx; + } } static int __init cpui_init(void) -- cgit v1.2.3-18-g5258