# Function __cpuid_count

1.27.0 · Source

    pub unsafe fn __cpuid_count(leaf: u32, sub_leaf: u32) -> CpuidResult

Available on x86 and (x86 or x86-64) only.
Expand description

Returns the result of the `cpuid` instruction for a given `leaf` (`EAX`) and `sub_leaf` (`ECX`).

The highest-supported leaf value is returned by the first tuple argument of `__get_cpuid_max(0)`. For leaves containing sub-leaves, the second tuple argument returns the highest-supported sub-leaf value.

The CPUID Wikipedia page contains how to query which information using the `EAX` and `ECX` registers, and the interpretation of the results returned in `EAX`, `EBX`, `ECX`, and `EDX`.

The references are:

- Intel 64 and IA-32 Architectures Software Developer’s Manual Volume 2: Instruction Set Reference, A-Z.
- AMD64 Architecture Programmer’s Manual, Volume 3: General-Purpose and System Instructions.