aboutsummaryrefslogtreecommitdiffstats
path: root/cpui-drv.c
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2023-05-01 14:28:58 +0400
committerJoursoir <chat@joursoir.net>2023-05-01 14:29:22 +0400
commitb54421714a649a1f16fdce5c7bbf25e8179cdfef (patch)
tree36d47cf7e627a22a1ca2cc9dc173a2fff6d14c3d /cpui-drv.c
parent8e585d790a158c213b1d5084496e153912b80027 (diff)
downloadcpui-drv-b54421714a649a1f16fdce5c7bbf25e8179cdfef.tar.gz
cpui-drv-b54421714a649a1f16fdce5c7bbf25e8179cdfef.tar.bz2
cpui-drv-b54421714a649a1f16fdce5c7bbf25e8179cdfef.zip
add extended CPU features detection
Diffstat (limited to 'cpui-drv.c')
-rw-r--r--cpui-drv.c14
1 files changed, 14 insertions, 0 deletions
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)