29.10.1. x86 CPUID instruction

Fills EAX, EBX, ECX and EDX with CPU information.

The exact data to show depends on the value of EAX, and for a few cases instructions ECX. When it depends on ECX, it is called a sub-leaf. Out test program prints eax == 0.

On 2017 Lenovo ThinkPad P51 for example the output EAX, EBX, ECX and EDX are:

0x00000016
0x756E6547
0x6C65746E
0x49656E69

EBX and ECX are easy to interpret:

  • EBX: 75 6e 65 47 == 'u', 'n', 'e', 'G' in ASCII

  • ECX: 6C 65 74 6E == 'l', 'e', 't', 'n'

so we see the string Genu ntel which is a shorthand for "Genuine Intel". Ha, I wonder if they had serious CPU pirating problems in the past? :-)

Information available includes:

The cool thing about this instruction is that it allows you to check the CPU specs and take alternative actions based on that inside your program.

On Linux, the capacity part of this information is parsed and made available at cat /proc/cpuinfo. See: http://unix.stackexchange.com/questions/43539/what-do-the-flags-in-proc-cpuinfo-mean

There is also the cpuinfo command line tool that parses the CPUID instruction from the command line. Source: http://www.etallen.com/cpuid.html