CPUID
From Wikipedia, the free encyclopedia
The CPUID opcode is an instruction (its name derived from CPU IDentification) for the x86 architecture. It was introduced by Intel in the early 1990s for later steppings of the 486 chip, and fully rolled out at the introduction of the Pentium processor.[1]
By using the CPUID opcode, software can determine processor type and the presence of features (like MMX/SSE). The CPUID opcode is 0FA2h and the value in the EAX register specifies what information to return.
Prior to the general availability of the CPUID instruction, programmers would write esoteric machine code which exploited minor differences in CPU behavior in order to determine the processor make and model.[2][3]
[edit] Calling CPUID
In assembly language the CPUID instruction takes no parameters as CPUID implicitly uses the EAX register. The EAX register should be loaded with a value specifying what information to return. CPUID should be called with EAX = 0
first, as this will return the highest calling parameter that the CPU supports. To obtain extended function information CPUID should be called with bit 31 of EAX set. To determine the highest extended function calling parameter, call CPUID with EAX = 80000000h
.
[edit] EAX=0: Get vendor ID
This returns the CPU's manufacturer ID string - a twelve character ASCII string stored in EBX, EDX, ECX - in that order. The highest basic calling parameter is returned in EAX.
The following are known processor manufacturer ID strings:
- "GenuineIntel" - Intel
- "AuthenticAMD" - AMD
- "CyrixInstead" - Cyrix
- "CentaurHauls" - Centaur
- "SiS SiS SiS " - SiS
- "NexGenDriven" - NexGen
- "GenuineTMx86", "TransmetaCPU" - Transmeta
- "RiseRiseRise" - Rise
- "UMC UMC UMC " - UMC
- "Geode by NSC" - National Semiconductor
- "AMDisbetter!" - early engineering samples of AMD K5 processor
[edit] EAX=1: Processor Info and Feature Bits
This returns the CPU's stepping, model, and family information in EAX (also called the signature of a CPU), feature flags in EDX and ECX, and additional feature info in EBX.
The format of the information in EAX is as follows:
- 3:0 - Stepping
- 7:4 - Model
- 11:8 - Family
- 13:12 - Processor Type
- 19:16 - Extended Model
- 27:20 - Extended Family
Intel and AMD have suggested applications to display the family of a CPU as the sum of the "Family" and the "Extended Family" fields shown above, and the model as the sum of the "Model" and the 4-bit left-shifted "Extended Model" fields shown above.
The processor info and feature flags are manufacturer specific but usually the Intel values are used by other manufacturers for the sake of compatibility.
[edit] EAX=2: Cache and TLB Descriptor Info
This returns a list of descriptors indicating cache and TLB capabilities in EAX, EBX, ECX and EDX registers.
[edit] EAX=3: Processor Serial Number
This returns the processor's serial number (if available) in ECX and EDX. Note the processor serial number was deprecated by Intel after the Pentium III.
[edit] EAX=80000000h: Get Highest Extended Function Supported
The highest calling parameter is returned in EAX.
[edit] EAX=80000001h: Extended Processor Info and Feature Bits
This returns extended feature flags in EDX and ECX.
[edit] EAX=80000002h,80000003h,80000004h: Processor Brand String
These return the processor brand string in EAX, EBX, ECX and EDX. CPUID must be issued with each parameter in sequence to get the entire 48-byte null-terminated ASCII processor brand string.
[edit] External links
- http://www.sandpile.org/ia32/cpuid.htm
- http://support.intel.com/support/processors/procid/
- http://balusc.xs4all.nl/srv/har-cpu-int-p4.php -- Gives Family-Model-Step for just about every core type
- CPUID guide:
- Windows programs:
- Linux programs: