Release version 0.1.10. Changed core count for Intel Core i5/i7 CPUs. Added CpuidEx function.
authormoel.mich
Tue, 02 Feb 2010 21:58:54 +0000
changeset 22e6832d4b89d2
parent 21 ac4bfce27a02
child 23 1662dea7a261
Release version 0.1.10. Changed core count for Intel Core i5/i7 CPUs. Added CpuidEx function.
External/WinRing0.dll
External/WinRing0x64.dll
Hardware/CPU/AMD10CPU.cs
Hardware/CPU/IntelCPU.cs
Hardware/WinRing0.cs
Properties/AssemblyInfo.cs
     1.1 Binary file External/WinRing0.dll has changed
     2.1 Binary file External/WinRing0x64.dll has changed
     3.1 --- a/Hardware/CPU/AMD10CPU.cs	Tue Feb 02 18:35:23 2010 +0000
     3.2 +++ b/Hardware/CPU/AMD10CPU.cs	Tue Feb 02 21:58:54 2010 +0000
     3.3 @@ -65,7 +65,9 @@
     3.4          coreCount = (cpuidExtData[8, 2] & 0xFF) + 1;
     3.5        
     3.6        // AMD family 10h processors support only one temperature sensor
     3.7 -      coreTemperature = new Sensor("Core", 0, SensorType.Temperature, this);
     3.8 +      coreTemperature = new Sensor(
     3.9 +        "Core" + (coreCount > 1 ? " #1 - #" + coreCount : ""), 0, 
    3.10 +        SensorType.Temperature, this);
    3.11  
    3.12        pciAddress = WinRing0.FindPciDeviceById(PCI_AMD_VENDOR_ID, 
    3.13          PCI_AMD_10H_MISCELLANEOUS_DEVICE_ID, 0);
     4.1 --- a/Hardware/CPU/IntelCPU.cs	Tue Feb 02 18:35:23 2010 +0000
     4.2 +++ b/Hardware/CPU/IntelCPU.cs	Tue Feb 02 21:58:54 2010 +0000
     4.3 @@ -50,7 +50,9 @@
     4.4      private Sensor[] coreTemperatures;
     4.5  
     4.6      private float tjMax = 0;
     4.7 +    private uint logicalProcessors;
     4.8      private uint logicalProcessorsPerCore;
     4.9 +    private uint coreCount;
    4.10  
    4.11      private const uint IA32_THERM_STATUS_MSR = 0x019C;
    4.12      private const uint IA32_TEMPERATURE_TARGET = 0x01A2;
    4.13 @@ -60,18 +62,23 @@
    4.14        
    4.15        this.name = name;
    4.16        this.icon = Utilities.EmbeddedResources.GetImage("cpu.png");
    4.17 -      
    4.18 -      uint logicalProcessors = 1;
    4.19 -      if (cpuidData.GetLength(0) > 0x04)
    4.20 +            
    4.21 +      logicalProcessorsPerCore = 1;
    4.22 +      if (cpuidData.GetLength(0) > 0x0B) {
    4.23 +        uint eax, ebx, ecx, edx;
    4.24 +        WinRing0.CpuidEx(0x0B, 0, out eax, out ebx, out ecx, out edx);
    4.25 +        logicalProcessorsPerCore = ebx & 0xFF; 
    4.26 +        WinRing0.CpuidEx(0x0B, 1, out eax, out ebx, out ecx, out edx);
    4.27 +        logicalProcessors = ebx & 0xFF;            
    4.28 +      } else if (cpuidData.GetLength(0) > 0x04) {
    4.29          logicalProcessors = ((cpuidData[4, 0] >> 26) & 0x3F) + 1;
    4.30 +        logicalProcessorsPerCore = 1;
    4.31 +      } else {
    4.32 +        logicalProcessors = 1;
    4.33 +        logicalProcessorsPerCore = 1;
    4.34 +      }
    4.35  
    4.36 -      logicalProcessorsPerCore = 1;
    4.37 -      if (cpuidData.GetLength(0) > 0x0B)
    4.38 -        logicalProcessorsPerCore = cpuidData[0x0B, 1] & 0xFF;
    4.39 -      if (logicalProcessorsPerCore == 0)
    4.40 -        logicalProcessorsPerCore = 1;
    4.41 -
    4.42 -      uint coreCount = logicalProcessors / logicalProcessorsPerCore;
    4.43 +      coreCount = logicalProcessors / logicalProcessorsPerCore;
    4.44  
    4.45        switch (family) {
    4.46          case 0x06: {
    4.47 @@ -147,7 +154,9 @@
    4.48        r.AppendLine("Intel CPU");
    4.49        r.AppendLine();
    4.50        r.AppendFormat("Name: {0}{1}", name, Environment.NewLine);
    4.51 -      r.AppendFormat("Number of cores: {0}{1}", coreTemperatures.Length, 
    4.52 +      r.AppendFormat("Number of cores: {0}{1}", coreCount, 
    4.53 +        Environment.NewLine);
    4.54 +      r.AppendFormat("Threads per core: {0}{1}", logicalProcessorsPerCore,
    4.55          Environment.NewLine);
    4.56        r.AppendFormat("TjMax: {0}{1}", tjMax, Environment.NewLine);
    4.57        r.AppendLine();
     5.1 --- a/Hardware/WinRing0.cs	Tue Feb 02 18:35:23 2010 +0000
     5.2 +++ b/Hardware/WinRing0.cs	Tue Feb 02 21:58:54 2010 +0000
     5.3 @@ -79,8 +79,10 @@
     5.4      
     5.5      public delegate uint GetDllStatusDelegate();
     5.6      public delegate bool IsCpuidDelegate();
     5.7 -    public delegate bool CpuidDelegate(uint index, out uint eax, out uint ebx, 
     5.8 -      out uint ecx, out uint edx);
     5.9 +    public delegate bool CpuidDelegate(uint index, 
    5.10 +      out uint eax, out uint ebx, out uint ecx, out uint edx);
    5.11 +    public delegate bool CpuidExDelegate(uint index, uint ecxValue, 
    5.12 +      out uint eax, out uint ebx, out uint ecx, out uint edx);
    5.13      public delegate bool RdmsrPxDelegate(uint index, ref uint eax, ref uint edx, 
    5.14        UIntPtr processAffinityMask);
    5.15      public delegate byte ReadIoPortByteDelegate(ushort port);
    5.16 @@ -99,14 +101,14 @@
    5.17      public static GetDllStatusDelegate GetDllStatus;
    5.18      public static IsCpuidDelegate IsCpuid;
    5.19      public static CpuidDelegate Cpuid;
    5.20 +    public static CpuidExDelegate CpuidEx;
    5.21      public static RdmsrPxDelegate RdmsrPx;
    5.22      public static ReadIoPortByteDelegate ReadIoPortByte;
    5.23      public static WriteIoPortByteDelegate WriteIoPortByte;
    5.24      public static SetPciMaxBusIndexDelegate SetPciMaxBusIndex;
    5.25      public static FindPciDeviceByIdDelegate FindPciDeviceById;
    5.26      public static ReadPciConfigDwordExDelegate ReadPciConfigDwordEx;
    5.27 -    public static WritePciConfigDwordExDelegate WritePciConfigDwordEx;
    5.28 -
    5.29 +    public static WritePciConfigDwordExDelegate WritePciConfigDwordEx;    
    5.30  
    5.31      private static void GetDelegate<T>(string entryPoint, out T newDelegate) 
    5.32        where T : class 
    5.33 @@ -125,6 +127,7 @@
    5.34        GetDelegate("GetDllStatus", out GetDllStatus);
    5.35        GetDelegate("IsCpuid", out IsCpuid);
    5.36        GetDelegate("Cpuid", out Cpuid);
    5.37 +      GetDelegate("CpuidEx", out CpuidEx);
    5.38        GetDelegate("RdmsrPx", out  RdmsrPx);
    5.39        GetDelegate("ReadIoPortByte", out ReadIoPortByte);
    5.40        GetDelegate("WriteIoPortByte", out WriteIoPortByte);
     6.1 --- a/Properties/AssemblyInfo.cs	Tue Feb 02 18:35:23 2010 +0000
     6.2 +++ b/Properties/AssemblyInfo.cs	Tue Feb 02 21:58:54 2010 +0000
     6.3 @@ -69,5 +69,5 @@
     6.4  // You can specify all the values or you can default the Build and Revision Numbers 
     6.5  // by using the '*' as shown below:
     6.6  // [assembly: AssemblyVersion("1.0.*")]
     6.7 -[assembly: AssemblyVersion("0.1.9.0")]
     6.8 -[assembly: AssemblyFileVersion("0.1.9.0")]
     6.9 +[assembly: AssemblyVersion("0.1.10.0")]
    6.10 +[assembly: AssemblyFileVersion("0.1.10.0")]