Hardware/CPU/IntelCPU.cs
changeset 264 718555482989
parent 250 c19d56a0bcad
child 306 e9127c00ada1
     1.1 --- a/Hardware/CPU/IntelCPU.cs	Thu Mar 17 20:16:01 2011 +0000
     1.2 +++ b/Hardware/CPU/IntelCPU.cs	Sat Mar 19 16:13:49 2011 +0000
     1.3 @@ -16,7 +16,7 @@
     1.4  
     1.5    The Initial Developer of the Original Code is 
     1.6    Michael Möller <m.moeller@gmx.ch>.
     1.7 -  Portions created by the Initial Developer are Copyright (C) 2009-2010
     1.8 +  Portions created by the Initial Developer are Copyright (C) 2009-2011
     1.9    the Initial Developer. All Rights Reserved.
    1.10  
    1.11    Contributor(s):
    1.12 @@ -44,6 +44,7 @@
    1.13  
    1.14      private enum Microarchitecture {
    1.15        Unknown,
    1.16 +      NetBurst,
    1.17        Core,
    1.18        Atom,
    1.19        Nehalem,
    1.20 @@ -144,6 +145,23 @@
    1.21                  break;
    1.22              }
    1.23            } break;
    1.24 +        case 0x0F: {
    1.25 +            switch (model) {
    1.26 +              case 0x00: // Pentium 4 (180nm)
    1.27 +              case 0x01: // Pentium 4 (130nm)
    1.28 +              case 0x02: // Pentium 4 (130nm)
    1.29 +              case 0x03: // Pentium 4, Celeron D (90nm)
    1.30 +              case 0x04: // Pentium 4, Pentium D, Celeron D (90nm)
    1.31 +              case 0x06: // Pentium 4, Pentium D, Celeron D (65nm)
    1.32 +                microarchitecture = Microarchitecture.NetBurst;
    1.33 +                tjMax = Floats(100); 
    1.34 +                break;
    1.35 +              default:
    1.36 +                microarchitecture = Microarchitecture.Unknown;
    1.37 +                tjMax = Floats(100);
    1.38 +                break;
    1.39 +            }
    1.40 +          } break;
    1.41          default:
    1.42            microarchitecture = Microarchitecture.Unknown;
    1.43            tjMax = Floats(100); 
    1.44 @@ -152,6 +170,7 @@
    1.45  
    1.46        // set timeStampCounterMultiplier
    1.47        switch (microarchitecture) {
    1.48 +        case Microarchitecture.NetBurst:
    1.49          case Microarchitecture.Atom:
    1.50          case Microarchitecture.Core: {
    1.51              uint eax, edx;
    1.52 @@ -167,9 +186,14 @@
    1.53                timeStampCounterMultiplier = (eax >> 8) & 0xff;
    1.54              }
    1.55            } break;
    1.56 -        default:
    1.57 -          timeStampCounterMultiplier = 1;
    1.58 -          break;
    1.59 +        default: {
    1.60 +            timeStampCounterMultiplier = 1;
    1.61 +            uint eax, edx;
    1.62 +            if (Ring0.Rdmsr(IA32_PERF_STATUS, out eax, out edx)) {
    1.63 +              timeStampCounterMultiplier =
    1.64 +                ((edx >> 8) & 0x1f) + 0.5 * ((edx >> 14) & 1);
    1.65 +            }
    1.66 +          } break;
    1.67        }
    1.68  
    1.69        // check if processor supports a digital thermal sensor
    1.70 @@ -216,6 +240,8 @@
    1.71        StringBuilder r = new StringBuilder();
    1.72        r.Append(base.GetReport());
    1.73  
    1.74 +      r.Append("Microarchitecture: ");
    1.75 +      r.AppendLine(microarchitecture.ToString());
    1.76        r.Append("Time Stamp Counter Multiplier: ");
    1.77        r.AppendLine(timeStampCounterMultiplier.ToString(
    1.78          CultureInfo.InvariantCulture));