diff options
author | Joursoir <chat@joursoir.net> | 2023-05-01 14:28:58 +0400 |
---|---|---|
committer | Joursoir <chat@joursoir.net> | 2023-05-01 14:29:22 +0400 |
commit | b54421714a649a1f16fdce5c7bbf25e8179cdfef (patch) | |
tree | 36d47cf7e627a22a1ca2cc9dc173a2fff6d14c3d | |
parent | 8e585d790a158c213b1d5084496e153912b80027 (diff) | |
download | cpui-drv-b54421714a649a1f16fdce5c7bbf25e8179cdfef.tar.gz cpui-drv-b54421714a649a1f16fdce5c7bbf25e8179cdfef.tar.bz2 cpui-drv-b54421714a649a1f16fdce5c7bbf25e8179cdfef.zip |
add extended CPU features detection
-rw-r--r-- | cpui-drv.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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) |