Saturday, December 20, 2008

CPUID: getting the brand name of the CPU

Last time I gave an example how to check SIMD support using the CPUID assembly instruction. We can use CPUID also to obtain the exact brand name of the CPU. For example, running this C program on my desktop I get

CPU brand: Intel(R) Pentium(R) 4 CPU 2.40GHz




We need to invoke the CPUID instruction three times with different integer constants in EAX, and copy the 16 bytes from EAX, EBX, ECX and EDX into a char buffer. So the brand name can be 48 characters long; and in my case, it is padded by spaces.

0 comments: