    CHKCPU
    04/04/99
    by Jan Steunebrink  < http://web.inter.nl.net/hcc/J.Steunebrink >

    CPU Identification utility v1.4
    -------------------------------

Introduction
------------
After a CPU and/or motherboard upgrade, it can be difficult to find the
correct motherboard jumper settings for clockspeed, CPU multiplication factor,
and (for 486 only) internal cache Write-Back/Write-Through mode selection.
I wrote this utility to have an easy check on these settings.


The program
-----------
The program comes in a ZIP-file (CHKCPU14.ZIP) which should contain the
following 2 files: CHKCPU.EXE  ;the program
                   CHKCPU.TXT  ;this text file.
The files have a date-time stamp of 04/04/99 - 1:40 am.
The program is written in assembly language and it is freeware.

The program is started by typing CHKCPU at the command prompt.
CHKCPU can be run from the DOS prompt or from a DOS-box within Windows.
However, on 486 class CPUs, accurate speed indications cannot be obtained
when the L1 cache is disabled.
CHKCPU should give the same speed indication accuracy when run under Windows
3.x/95/98 (in 'Protected mode') compared to the 'Real mode' DOS environment.
Windows NT/2000 is a special case. Here, CHKCPU cannot use the Pentium Time
Stamp Counter and it does not always give a realistic speed reading.
The behavior of CHKCPU under OS/2 is unknown.
So generally, I recommend running CHKCPU after a clean boot to DOS, without
an expanded memory manager (EMM386 or QEMM) loaded.


On my upgraded 486 PC, the program displays the following information:

 CPU Identification utility v1.4                    (c) 1997-99 Jan Steunebrink
 
 CPU Vendor and Model: AMD 5x86-133 P75 (X5) in 4x clock mode
 Internal CPU speed  : 132.9 MHz
 CPU-ID Vendor string: AuthenticAMD
 CPU-ID Signature    : 04F4
                        Stepping or sub-model no.
                        Model: Indicates CPU Model and 486 L1 cache mode
                        Family: 4=486, Am5x86, Cx5x86
                                  5=Pentium, Nx586, Cx6x86, K5/K6, C6, mP6
                                  6=PentiumPro/II/III, Cx6x86MX
                        Type: 0=Standard, 1=Overdrive, 2=2nd Dual Pentium
 Current CPU mode    : Virtual
 Internal (L1) cache : Enabled in Write-Back mode

On another upgraded PC, with a Cyrix M2 PR233 CPU, I got:

 CPU Identification utility v1.4                    (c) 1997-99 Jan Steunebrink
 
 CPU Vendor and Model: Cyrix/IBM 6x86MX (M2) in 3.0x clock mode
 Internal CPU speed  : 200.4 MHz  (using Pentium Time Stamp Counter)
 CPU-ID Vendor string: CyrixInstead
 CPU-ID Signature    : 0600
                        Stepping or sub-model no.
                        Model: Indicates CPU Model and 486 L1 cache mode
                        Family: 4=486, Am5x86, Cx5x86
                                  5=Pentium, Nx586, Cx6x86, K5/K6, C6, mP6
                                  6=PentiumPro/II/III, Cx6x86MX
                        Type: 0=Standard, 1=Overdrive, 2=2nd Dual Pentium
 Cyrix Device Id Regs: DIR0: 53h  CPU Model
                       DIR1: 07h  CPU Step and Revision
 Current CPU mode    : Real
 Internal (L1) cache : Enabled in Write-Back mode

And running CHKCPU under Win98 on a laptop with an Intel Celeron 300a:

 CPU Identification utility v1.4                    (c) 1997-99 Jan Steunebrink
 
 CPU Vendor and Model: Intel PentiumII 300/333/366/400 A0-step for mobile use
                       with 128 KB integrated L2 cache (Celeron-A type)
 Internal CPU speed  : 300.7 MHz  (using Pentium Time Stamp Counter)
 CPU-ID Vendor string: GenuineIntel
 CPU-ID Signature    : 0660
                        Stepping or sub-model no.
                        Model: Indicates CPU Model and 486 L1 cache mode
                        Family: 4=486, Am5x86, Cx5x86
                                  5=Pentium, Nx586, Cx6x86, K5/K6, C6, mP6
                                  6=PentiumPro/II/III, Cx6x86MX
                        Type: 0=Standard, 1=Overdrive, 2=2nd Dual Pentium
 Current CPU mode    : Protected
 Internal (L1) cache : Enabled in Write-Back mode


CHKCPU presently only recognizes CPUs which support the CPUID instruction or
Cyrix CPUs with Device Identification Register (DIR) support.
This covers some 486 and all 586/Pentium and higher CPUs.
The program recognizes CPUs from Intel, AMD, NexGen, Cyrix/IBM, UMC, IDT,
and Rise.

On Cyrix CPUs, the CPUID instruction can be disabled via a CPU configuration
register. On some PCs the BIOS disables CPUID during boot-up. CHKCPU checks
for this condition and enables CPUID again. All other Cyrix CPU configuration
registers that CHKCPU uses are restored to their previous state.

On IDT CPUs, the CPUID Vendor string and Signature can be programmed to any
value. CHKCPU checks for this condition and temporarily disables this
programming to show the real Vendor string and Signature of these CPUs.
However, this check can only be done in 'Real mode' and is therefore skipped
if the CPU is in 'Virtual or Protected mode' (EMM386, Windows).

The Internal CPU speed display accuracy is at its best if the program is run
with the CPU internal (Level 1) cache enabled.
An 'attention' message is displayed if this condition is not met.
The CPU speed is measured by accurately timing the execution of a bunch of
slow 'Divide' instructions.
For Pentium class CPUs however, the internal Time Stamp Counter (TSC) is used
whenever possible to further improve the accuracy of the speed measurement.
A message behind the CPU speed display indicates if the TSC is used.
As using the TSC would crash the program when the CPU is in 'Virtual mode',
the CPU speed measurement switches back to the (less accurate) plain
instruction timing method when the CPU is not in 'Real or Protected mode'.
When the program runs in 'Protected mode' but not under Win 3.x/95/98, it
also switches to the plain instruction timing method to avoid problems with
Windows NT/2000.


Error and Unknown messages
--------------------------
CHKCPU has to use a lot of 32-bit instructions. If the program is run
on a 16-bit CPU like the 8086/88, 80186/88, or 80286 you will see:
 ERROR: This program requires a 386 or higher CPU!

If the program is run on a 386 or (non-Cyrix) 486 CPU without CPUID support
you will see:
 ERROR: This processor does not support the CPUID instruction.
        Probably a 'classic' Intel/AMD 386 or 486 CPU.

If CHKCPU is unable to detect the CPU Vendor you get an "Unknown" indication.
If CHKCPU is unable to detect the CPU Model you'll see -Unknown model-.

If a Cyrix CPU is detected but no DIR support is found you get:
 Cyrix Device Id Regs: - DIR registers could not be found -
This is correct on the early Cx486 CPUs but most Cx486 and all Cx5x86 and
later Cyrix CPUs should support the Device Identification Registers.
On Cyrix 486 CPUs without CPUID support you'll get:
 CPU-ID Vendor string: - No CPUID -


Internal CPU speed
------------------
Since the Intel 486DX2 hit the market, most CPUs run internally faster
than externally.
The Internal CPU speed display indicates the true internal CPU clock speed.
The internal CPU clock speed = Bus clock X multiplication factor.
The Bus clock is the speed of the motherboard clock.
486 boards are normally selectable at 25, 33.3, 40, 50, and 60 (some) MHz and
Pentium boards at 50, 60, 66.6, 75, 83.3, 95.2, 100, and 112 (some) MHz.
The selectable multiplication factor depends on the CPU and can be anything
upto 6x but older CPUs are usually limited at 3x.
Some CPUs have a fixed multiplication factor.
On Pentium boards, the multiplication factor is usually selectable in steps
of 0.5.

For Intel CPUs the internal speed equals the rating. So a Pentium 200 will
run internally at 200 MHz. (66.6 x 3)
For AMD, Cyrix, and Rise CPUs the internal speed can be lower than the PR
rating due newer and more efficient design.
For the K6-2 and later AMD CPUs, the internal speed equals the rating again.


Internal (L1) cache
-------------------
The program detects if the internal (Level 1) cache is disabled or enabled.
If enabled, the program indicates if the cache operates in the Write-Through
(read only cache) or Write-Back (read and write cache) mode.
For the 486 CPU family, this information is derived from the CPU-ID signature,
except for Cyrix CPUs where it is taken from Configuration Control Register #2
(C2h) bit 1 (WBAK - Write Back Cache Interface Pins Enable).

Except for the Nx586 and the Intel Pentium 63/83 ODP (P24T), the Pentium
and higher CPU families always operate their L1 cache in Write-Back mode.
The Nx586 has only Write-Through mode and is indicated as such.
The P24T can operate in either the Write-Through or Write-Back mode.
For this CPU, CHKCPU uses a special routine to detect the difference, but the
CPU needs to be in 'Real mode' for this check to work.
This check is therefore skipped if the P24T is not running in 'Real mode'.


Acknowledgments
---------------
I could not have written this program without the hard work of these people:
- Christian Ludloff http://www.sandpile.org/80x86/ for his unsurpassed amount
  and detail of CPU information.
- Grzegorz Mazur http://grafi.ii.pw.edu.pl/gbm/x86/ for publishing the basic
  algorithms for CPU detection.
- Frank van Gilluwe, author of "The Undocumented PC" (second edition); still
  my favorite hardware book.
  The internal CPU speed detection routine according the instruction timing
  method is based on ideas from his book.


Feedback requested
------------------
If you encounter any "Unknown" message or if you have any questions regarding
this program, please send me an E-mail with your CPU details.

J.Steunebrink@net.HCC.nl

------------------------------------------------------------------------------
Chkcpu revision history:

Version 1.4
04/04/99
- Updated the CPU data with the new AMD K6-2 (CTX-core), K6-III,
  Intel PentiumII/Celeron, and PentiumIII steppings.
- Added support for the Rise mP6 CPU.
- Added display of the amount of integrated L2 cache on the PentiumPro/II/III,
  AMD K6-III, and Cyrix M3 CPUs. For the Intel PentiumII an additional
  'Celeron or Celeron-A type' indication is added when appropriate.
- Rewritten the program so that it runs in (16-bit) Protected mode whenever a
  DOS Protected Mode Interface (DPMI) host is present. (Windows, OS/2, etc.)
  This improves the speed display accuracy in the DOS-box for all CPUs and in
  addition, under Windows 3.x/95/98 on the Pentium class CPUs, the internal
  Time Stamp Counter can now be used, just as in Real mode.
- Added display of the Current CPU mode: Real, Virtual, or Protected.

Version 1.3
12/12/98
- Updated the CPU data. The new AMD K6-2, IDT C6-2, and Intel PentiumII/
  Celeron/Xeon steppings are now supported.
- Added a new Internal speed detection routine for all CPUs that support the
  Pentium Time Stamp Counter. This results in a more accurate speed display,
  especially on non-Intel CPUs (only in Real mode).
- Made the program better usable under Windows by adding checks for
  protected mode before using 'restricted' instructions.
  This avoids triggering a General Protection Fault.
- Fixed a bug where the program was aborted by Windows if run on a 386
  or (non-Cyrix) 486 CPU without CPUID support.

Version 1.2
04/04/98
- Updated the CPU data. The new Pentium II 333 (Deschutes) is now supported.
- Fixed the Intel Pentium Pro detection. CHKCPU v1.1 indicated these CPUs as
  a "Cyrix -Unknown model-".

Version 1.1
02/02/98 First update.
- Updated the CPU data.
- Added CPU multiplication factor indication for the Cx486DX4 and AMD K5.
- Expanded the internal CPU speed display with a decimal.
- Updated the internal cache mode detection for early Cyrix/TI CPUs.
- Fixed the Intel Pentium 63/83 ODP (P24T) internal cache mode detection.
  CHKCPU v1.0 indicated the internal cache mode of the P24T always as WB.
  This is not correct as the P24T can also operate in WT mode.
  For this CPU, a routine has been added to detect the difference.

Version 1.0
12/12/97 First release.
------------------------------------------------------------------------------

