Fixed Intel CPU coreCount in case CPUID 0x0B is supported but returns only 0.

This commit is contained in:
Michael Möller
2010-02-03 18:10:11 +00:00
parent a0c01caaca
commit 7b07ba9fe6

View File

@@ -63,17 +63,21 @@ namespace OpenHardwareMonitor.Hardware.CPU {
this.name = name;
this.icon = Utilities.EmbeddedResources.GetImage("cpu.png");
logicalProcessorsPerCore = 1;
logicalProcessors = 0;
if (cpuidData.GetLength(0) > 0x0B) {
uint eax, ebx, ecx, edx;
WinRing0.CpuidEx(0x0B, 0, out eax, out ebx, out ecx, out edx);
logicalProcessorsPerCore = ebx & 0xFF;
WinRing0.CpuidEx(0x0B, 1, out eax, out ebx, out ecx, out edx);
logicalProcessors = ebx & 0xFF;
} else if (cpuidData.GetLength(0) > 0x04) {
logicalProcessorsPerCore = ebx & 0xFF;
if (logicalProcessorsPerCore > 0) {
WinRing0.CpuidEx(0x0B, 1, out eax, out ebx, out ecx, out edx);
logicalProcessors = ebx & 0xFF;
}
}
if (logicalProcessors <= 0 && cpuidData.GetLength(0) > 0x04) {
logicalProcessors = ((cpuidData[4, 0] >> 26) & 0x3F) + 1;
logicalProcessorsPerCore = 1;
} else {
}
if (logicalProcessors <= 0) {
logicalProcessors = 1;
logicalProcessorsPerCore = 1;
}