CPU detection code

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Guest

CPU detection code

Post by Guest »

I know that there is "CPUID" to classify the Pentium class CPU. How about 8086, 80286, 80386, and 80486?

Thanks.
carbonBased

RE:CPU detection code

Post by carbonBased »

Check out:
http://grafi.ii.pw.edu.pl/gbm/x86/x86id.html

It's got info on how to detect all forms of Intel CPUs, with and/or without CPUID.

Essentially, you're testing for bits that can be set on newer processors, but cannot be set on older ones.  Or, in the case of the 8086, you're check for defined behaviour in shifting past its limits.

Why you'd want to detect anything prior to a 386, though, I don't know... if you're writting a pmode OS, a simple 386+ routine would probably do (perhaps a Pentium+ detect if you use pentium specific opcodes, and/or 4MB pages).

Hope that helps,
Jeff
Post Reply