Detecting Processors

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
jcout_bsi

Detecting Processors

Post by jcout_bsi »

I need some Assembly code to detect processors so that i can use pre optimized code. Start with a 386 and move to P4 and AMD 2100+ XP... Start with 386 because 386 or lower will not be able to run my code.(Could just would take a lot longer that you would be willing to sit and wait.)
Curufir

Re:Detecting Processors

Post by Curufir »

386 -> 586 detection is a nightmare and basically depends on certain features being present/not present/broken. Detecting as greater than 286 is easy enough (There's tutorials littered all over the web, mostly in bootsectors), but detecting model is problematic at best (Wouldn't be if whichever morons programmed BIOS didn't remove the information before handing it to your code).

After 586 use the cpuid instruction, it's well documented and will detect processor model, stepping and all those other fun things.

Curufir
K.J.

Re:Detecting Processors

Post by K.J. »

Look around on Dr. Dobbs Journal website(http://ddj.com/) there was an article there about a year ago that talked about identifying 386, 486, and the original pentiums(after the original pentium, just use cpuid like Curufir said).

K.J.
Post Reply