CPUid
CPUID is an instruction in the x86 architecture that allows software to query processor identity and capabilities. When executed, it returns information in the EAX, EBX, ECX, and EDX registers. The data produced depends on the input value placed in EAX (and sometimes ECX) before the call. CPUID is implemented by Intel and AMD and is available on most compatible processors; it is commonly used by operating systems, system utilities, compilers, and virtualization platforms to tailor behavior to the running CPU.
The instruction is organized into a set of leaves or function numbers. The most frequently used leaves
- Function 0: reports the highest supported function ID, allowing software to discover the range of available
- Function 1: returns processor version information (family, model, stepping) in EAX and feature flags in EDX
- Function 2: provides cache and TLB descriptors.
- Function 4: offers deterministic cache parameter data for each level of cache.
- Function 7, subleaf 0: exposes extended feature flags, including newer instruction sets and capabilities.
- Function 0x80000000 and above: provide extended information, including the processor brand string when combined from 0x80000002,
In addition, many systems use higher-numbered leaves under 0x40000000 to indicate virtualization, returning hypervisor-related information when
CPUID data is commonly used to detect capabilities, enable or disable optimized code paths, and determine CPU
---