Tutorial on CPU detection

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
beyondsociety

Tutorial on CPU detection

Post by beyondsociety »

Does anybody know of any tutorials on how to detect the type of processor for pentium and AMD type processors.

Also does anybody know how to detect the version and maker of the cpu.

Either links or examples in assembly would help.

Thanks in advance!
Warmaster199

Re:Tutorial on CPU detection

Post by Warmaster199 »

I was just looking at the Intel 486 documentation today :)

You can use the CPUID instruction for 486DX and better processors. do:
mov eax, 0x00000000
cpuid
...and then ebx, edx, and edx(I forget the order) will give you the string "GenuineIntel". With the first reg holding "uneG", the next holding "Ieni" and so on... For AMD processors, the 12-character string is "AuthenticAMD", decoded the same way...

if you do:
mov eax, 0x00000001
cpuid
...then eax is filled with tons of stuff:
bits 0-3 give the CPU's stepping number(revision?)
bits 4-7 give the CPU's Model in it's family...
bits 8-11 give the CPU's family number, 4 = 486, 5 = Pentium/K6, 6 = Pentium II, III, IV, Celery, Athlon, Duron...(use model # to find the exact chip...
bits 12 and 13 are processor type.
bits 14-31 are reserved (On the i486, not sure about other CPUs...)

I hope this was EXACTLY what you were looking for! 8)
gedeon

Re:Tutorial on CPU detection

Post by gedeon »

You can find here
- more details
- ASM source code
- c source
for cpu detection
ftp://download.intel.com/design/Xeon/applnots/24161821.pdf
very good documentation on CPUID
gedeon

Re:Tutorial on CPU detection

Post by gedeon »

Check this for AMD CPU
It's the same idea.
http://www.amd.com/us-en/assets/content ... /20734.pdf
Post Reply