PDA

View Full Version : CPU (AMD, Intel) detection


Dark-Cracker
14th June 2002, 01:38
Hi,

i try to know how to find if a processor it an AMD or Intel.
i think the best way is to try to detect if the CPU support SSE or 3D Now feature.

does somethink like this is correct ?

detect SSE => Pentium III
detect SSE2 => Pentium IV
detect 3D Now! => AMD (perhaps K7)
detect 3D Now! Extensions => AMD (perhaps AMD XP)

is it the best way ? or perhaps a detection of the ID (GenuieIntel...) or perhaps by the family, model and stepping.

thank u :)

bye.

DaveEL
14th June 2002, 06:24
detect SSE => Pentium III
detect SSE2 => Pentium IV
detect 3D Now! => AMD K6-2/K6-3
detect 3D Now! Extensions => AMD Athlon
detect 3d Now! pro => Athlon Xp/MP


DaveEL

Dark-Cracker
14th June 2002, 06:44
thank i don't have the ams fonction for the 3D now pro but your answer will help me much, thank u ver very much.

Richard Berg
19th June 2002, 05:48
Athlon XP has SSE, and Hammer will have SSE2, so this probably isn't a good way to go about things.

DaveEL
19th June 2002, 05:59
If the tests are done in the order given xp will be detected as such and hammers will also be detected as xps which means the tests will answer the initial question of who made the processor.


Then again if your just trying to work out amd or intel then

Type = intel
If (Processor does 3dnow) type = amd

that will work assuming not run on anything but amd or intel and no amd before k6-2 if you want to be sure the checking the id of GenuineIntel or AuthenticAmd would be best.

Of course im not sure why you would want that information?

DaveEL

drstock
24th June 2002, 15:38
From the top of my head:

void main() {
char vendor[13];
_asm {
xor eax,eax
db 0fh,0a2h // CPUID
mov vendor,ebx
mov [vendor+4],edx
mov [vendor+8],ecx
}
vendor[12] = '\0';
printf("%s\n",vendor);
}

This is far from the best way to do it but you can do a lot more magic with the CPUID instruction.

Btw, it's been a while since i coded assembler, but you should get the picture. =)

trbarry
24th June 2002, 23:43
I don't have a link but AMD offers sample code on their site that determines what features are supported.

There is also a function for this in DVD2AVI, including SSE2 support. A save-oe assembler version source of this can be found in www.trbarry.com/DVD2AVIT3.zip .

- Tom

Dark-Cracker
26th June 2002, 23:46
thank u all for your answer :) and thank u very , i think i will use the vendor id. Bye.