Behavioral identification of 386-class CPUs; checking for 486+

Copyright 1996-2000 by Grzegorz Mazur
All the brand names used here belong to their owners.

 

 

Last updated: 2000-09-18.


Revision history:
2000-09-18 - more details
1996-03-25 - initial version, not yet finished


This part of article describes the routines for recognizing various 386-class machines. The test for 486 or better CPU is presented.


Some background

There are several 386-class chips. Intel original 80386, later renamed to 386DX has at least 3 easily distinguishable varieties. There is also 386SX, with 16-bit bus, Chips and Technologies 38600DX and IBM 386SLC. In general, late Intel and AMD chips are the same, several early Intel varieties can be distinguished, and we can also recognize SX and C&T stuff.

NexGen Nx586 chips produced until late 1995 also fit into the 386 cathegory. Although they are architecturally more advanced than Pentium, they support the instruction set architecture of 386.

All the 386-class and better chips support the identification mechanism. After hardware reset, the chip signature is placed by microcode in EDX register. Unfortunately, there is no way other than reset to obtain it, so the mechanism is not very useful, although it can usually be used in real mode. Follow this link for details.


386(and Nx586) vs. 486+

80486 and newer CPUs support the alignment check mechanism. The CPU, while executing in its least privilleged state, can be forced to report exception when 32-bit data is accessed in memory at the address not being the multiple of 4. Alignment check mode is enabled by setting bit 18 of EFLAGS register to one. There is no such bit on 386 CPUs, so it can not be toggled... To check for AC bit presence, we must first save ESP into some other register and align it, rounding its contents down to a multiple of 4. Then we save EFLAGS, change AC bit, set EFLAGS, save it again and restore the previous value. If the value of AC in both saved copies is different, we have 486+ CPU. Otherwise we have some 386 or NexGen Nx586.


Checking for old 80386 (sigma-pi)

Old 80386, also known as sigma-pi chips, had famuous multiply bug. 32-bit multiply was returning incorrect results.


Checking for real Intel(or AMD) 32-bit 386 (80386, 386DX)

All the classic 32-bit 386 chips have POPAD bug. The bug exhibits when instructions using 32-bit indexed addressing mode immediately follows POPAD instruction. In such case the content of EAX may not be correctly updated by POPAD. The test should be executed several times in a loop, cause the error may be masked by interrupt.
If the chip does not exhibit POPAD bug, it is probably C&T 38600DX.
I have no information on POPAD behavior of IBM 386SLC.


AMD 386DXLV & SXLV chips

These may be probably detected by checking for the presence of UMOV instruction. UMOV is a SMM instruction similar to MOV and is described in AMD manuals.


Copyright 1996-2000 by Grzegorz Mazur