mirror of
https://github.com/Dr-Noob/cpufetch
synced 2025-09-04 00:05:29 +00:00
Fix topology in AMD, using extended level to fetch it
This commit is contained in:
@@ -229,7 +229,6 @@ struct topology* get_topology_info(struct cpuInfo* cpu) {
|
|||||||
}
|
}
|
||||||
topo->smt = ebx & 0xFFFF;
|
topo->smt = ebx & 0xFFFF;
|
||||||
|
|
||||||
|
|
||||||
eax = 0x0000000B;
|
eax = 0x0000000B;
|
||||||
ecx = 0x00000001;
|
ecx = 0x00000001;
|
||||||
cpuid(&eax, &ebx, &ecx, &edx);
|
cpuid(&eax, &ebx, &ecx, &edx);
|
||||||
@@ -249,7 +248,28 @@ struct topology* get_topology_info(struct cpuInfo* cpu) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VENDOR_AMD:
|
case VENDOR_AMD:
|
||||||
printBug("Unimplemented!");
|
if (cpu->maxExtendedLevels >= 0x80000008) {
|
||||||
|
eax = 0x80000008;
|
||||||
|
cpuid(&eax, &ebx, &ecx, &edx);
|
||||||
|
topo->logical_cores = (ecx & 0xFF) + 1;
|
||||||
|
|
||||||
|
if (cpu->maxExtendedLevels >= 0x8000001E) {
|
||||||
|
eax = 0x8000001E;
|
||||||
|
cpuid(&eax, &ebx, &ecx, &edx);
|
||||||
|
topo->smt = ((ebx >> 8) & 0x03) + 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printWarn("Can't read topology information from cpuid (needed extended level is 0x%.8X, max is 0x%.8X)", 0x8000001E, cpu->maxLevels);
|
||||||
|
topo->smt = 1;
|
||||||
|
}
|
||||||
|
topo->physical_cores = topo->logical_cores / topo->smt;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printWarn("Can't read topology information from cpuid (needed extended level is 0x%.8X, max is 0x%.8X)", 0x80000008, cpu->maxLevels);
|
||||||
|
topo->physical_cores = 1;
|
||||||
|
topo->logical_cores = 1;
|
||||||
|
topo->smt = 1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printBug("Cant get topology because VENDOR is empty");
|
printBug("Cant get topology because VENDOR is empty");
|
||||||
|
Reference in New Issue
Block a user