[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Dropping/splitting (proper) i386 support



Hi,

On Mon, May 05, 2003 at 06:27:05PM -0400, Nathanael Nerode wrote:
> After the 486, Intel always provided a method to determine the CPU type and 
> features available.  As far as I can tell, there's no easy programmatic way 
> to tell the difference between a (old, no CPUID) 486 and an (old, no CPUID) 
> 386 without risking an illegal instruction, which bites. :-(  (I could be 
> wrong.)

They exist and are not so difficult. One is by issuing illegal
instructions like you have commented, the only thing to do is to trap
INT 6 (Invalid Opcode). The only problem you may find is that really old
cpus don't support this INT (only 80186+).

The other is a little bit more fun, you have to test for cpu specific
non-documented behaviour, like how many bits shift a shl in a 8088 or
80186+, when does the cpu increment the sp (stack pointer) when doing
a push/pop, which flags can or cannot be set, etc. I did some years ago
asm code that distinguished from 8088 to the new CPUID aware cpus,
including the distinction from 8086 and 8088, or from NEC V20 among
others. =P

And I've seen code that did more insight testing. (I can give
code / pointers to anyone interested).

regards,
guillem



Reply to: