# HG changeset patch # User moel.mich # Date 1300551229 0 # Node ID 7185554829899c0b86a5f2782bf46a7640a8c3e2 # Parent 575f8d4c378dc851514cf6d87259ac5ac5f7e88b Fixed Issue 158. diff -r 575f8d4c378d -r 718555482989 Hardware/CPU/IntelCPU.cs --- a/Hardware/CPU/IntelCPU.cs Thu Mar 17 20:16:01 2011 +0000 +++ b/Hardware/CPU/IntelCPU.cs Sat Mar 19 16:13:49 2011 +0000 @@ -16,7 +16,7 @@ The Initial Developer of the Original Code is Michael Möller . - Portions created by the Initial Developer are Copyright (C) 2009-2010 + Portions created by the Initial Developer are Copyright (C) 2009-2011 the Initial Developer. All Rights Reserved. Contributor(s): @@ -44,6 +44,7 @@ private enum Microarchitecture { Unknown, + NetBurst, Core, Atom, Nehalem, @@ -144,6 +145,23 @@ break; } } break; + case 0x0F: { + switch (model) { + case 0x00: // Pentium 4 (180nm) + case 0x01: // Pentium 4 (130nm) + case 0x02: // Pentium 4 (130nm) + case 0x03: // Pentium 4, Celeron D (90nm) + case 0x04: // Pentium 4, Pentium D, Celeron D (90nm) + case 0x06: // Pentium 4, Pentium D, Celeron D (65nm) + microarchitecture = Microarchitecture.NetBurst; + tjMax = Floats(100); + break; + default: + microarchitecture = Microarchitecture.Unknown; + tjMax = Floats(100); + break; + } + } break; default: microarchitecture = Microarchitecture.Unknown; tjMax = Floats(100); @@ -152,6 +170,7 @@ // set timeStampCounterMultiplier switch (microarchitecture) { + case Microarchitecture.NetBurst: case Microarchitecture.Atom: case Microarchitecture.Core: { uint eax, edx; @@ -167,9 +186,14 @@ timeStampCounterMultiplier = (eax >> 8) & 0xff; } } break; - default: - timeStampCounterMultiplier = 1; - break; + default: { + timeStampCounterMultiplier = 1; + uint eax, edx; + if (Ring0.Rdmsr(IA32_PERF_STATUS, out eax, out edx)) { + timeStampCounterMultiplier = + ((edx >> 8) & 0x1f) + 0.5 * ((edx >> 14) & 1); + } + } break; } // check if processor supports a digital thermal sensor @@ -216,6 +240,8 @@ StringBuilder r = new StringBuilder(); r.Append(base.GetReport()); + r.Append("Microarchitecture: "); + r.AppendLine(microarchitecture.ToString()); r.Append("Time Stamp Counter Multiplier: "); r.AppendLine(timeStampCounterMultiplier.ToString( CultureInfo.InvariantCulture));