Hardware/CPU/IntelCPU.cs
changeset 7 9523a3322777
parent 5 a5ecd988d38f
child 13 d32fc5f2e822
     1.1 --- a/Hardware/CPU/IntelCPU.cs	Thu Jan 28 19:31:10 2010 +0000
     1.2 +++ b/Hardware/CPU/IntelCPU.cs	Thu Jan 28 23:29:39 2010 +0000
     1.3 @@ -49,7 +49,8 @@
     1.4  
     1.5      private Sensor[] coreTemperatures;
     1.6  
     1.7 -    private float tjMax = 0;   
     1.8 +    private float tjMax = 0;
     1.9 +    private uint logicalProcessorsPerCore;
    1.10  
    1.11      private const uint IA32_THERM_STATUS_MSR = 0x019C;
    1.12      private const uint IA32_TEMPERATURE_TARGET = 0x01A2;
    1.13 @@ -64,7 +65,7 @@
    1.14        if (cpuidData.GetLength(0) > 0x04)
    1.15          logicalProcessors = ((cpuidData[4, 0] >> 26) & 0x3F) + 1;
    1.16  
    1.17 -      uint logicalProcessorsPerCore = 1;
    1.18 +      logicalProcessorsPerCore = 1;
    1.19        if (cpuidData.GetLength(0) > 0x0B)
    1.20          logicalProcessorsPerCore = cpuidData[0x0B, 1] & 0xFF;
    1.21        if (logicalProcessorsPerCore == 0)
    1.22 @@ -159,7 +160,8 @@
    1.23        uint eax = 0, edx = 0;      
    1.24        for (int i = 0; i < coreTemperatures.Length; i++) {
    1.25          if (WinRing0.RdmsrPx(
    1.26 -          IA32_THERM_STATUS_MSR, ref eax, ref edx, (UIntPtr)(1 << i))) 
    1.27 +          IA32_THERM_STATUS_MSR, ref eax, ref edx, 
    1.28 +            (UIntPtr)(logicalProcessorsPerCore << i))) 
    1.29          {
    1.30            // if reading is valid
    1.31            if ((eax & 0x80000000) != 0) {