10 "Unknown",
"GenuineIntel",
"AuthenticAMD",
13 #if defined(__i386__) || defined(__x86_64__)
23 #define cpuid_func(reg) \
24 unsigned int cpuid_##reg(unsigned int op) \
26 unsigned int eax, ebx, ecx, edx; \
27 __cpuid(op, eax, ebx, ecx, edx); \
50 unsigned int unknown = 0xffffff;
61 fp = fopen(
"/proc/cpuinfo",
"r");
66 if (!fgets(value, 64, fp))
70 if (!
strncmp(value,
"processor\t: ", 12))
71 sscanf(value,
"processor\t: %u", &proc);
77 if (!
strncmp(value,
"vendor_id", 9)) {
79 if (
strstr(value, cpu_vendor_table[x]))
83 }
else if (!
strncmp(value,
"cpu family\t: ", 13)) {
84 sscanf(value,
"cpu family\t: %u",
86 }
else if (!
strncmp(value,
"model\t\t: ", 9)) {
87 sscanf(value,
"model\t\t: %u",
89 }
else if (!
strncmp(value,
"stepping\t: ", 10)) {
90 sscanf(value,
"stepping\t: %u",
95 cpu_info->
family == unknown ||
96 cpu_info->
model == unknown ||
114 cpuid_level = cpuid_eax(0);
115 ext_cpuid_level = cpuid_eax(0x80000000);
118 if (ext_cpuid_level >= 0x80000007 &&
119 (cpuid_edx(0x80000007) & (1 << 8)))
123 if (cpuid_level >= 6 && (cpuid_ecx(6) & 0x1))
128 if (ext_cpuid_level >= 0x80000007 &&
129 (cpuid_edx(0x80000007) & (1 << 9)))
134 if (cpuid_level >= 6 &&
135 (cpuid_eax(6) & (1 << 1)))
141 if (cpuid_level >= 6 && (cpuid_ecx(6) & (1 << 3)))
145 if (cpu_info->
family == 6) {
146 switch (cpu_info->
model) {