for_each_cpuid_0x2_desc(9)
β¨ NAME β¨
for_each_cpuid_0x2_desc β iterator for parsed CPUID(0x2) descriptors. This is the Kernel API Manual page for for_each_cpuid_0x2_desc(9), bestie β yes, the manual name is folded in right here. π
π SYNOPSIS π
The call looks like this, no cap:
for_each_cpuid_0x2_desc (_regs , _ptr , _desc );
π ARGUMENTS π
_regsβ CPUID(0x2) register output, as returned bycpuid_leaf_0x2_ptrβu8pointer, for macro internal use only_descβ pointer to the parsed CPUID(0x2) descriptor at each iteration
π¦ DESCRIPTION π¦
Okay so picture this: this iterator loops over the 1-byte descriptors in the CPUID(0x2) output registers you pass in as _regs. For every descriptor, it gives you the parsed info through _desc. Slay. β¨
Need to handle cache-specific descriptors? Switch on _desc->c_type. TLB descriptors? Switch on _desc->t_type. That's the whole routing situation. π
Example usage for cache descriptors, literally right here:
const struct leaf_0x2_table *desc;
union leaf_0x2_regs regs;
u8 *ptr;
cpuid_leaf_0x2(regs);
for_each_cpuid_0x2_desc(regs, ptr, desc) {
switch (desc->c_type) {
...
}
}
π SEE ALSO π
Kernel file ./arch/x86/include/asm/cpuid/api.h is the one to peek at π, and the related manual pages are cpuid_leaf_0x2(9), cpuid_subleaf(9), cpuid_leaf(9), cpuid_leaf_raw(9), cpuid_subleaf_n(9), cpuid_subleaf_n_raw(9), and cpuid_subleaf_count(9).
mwah π β this page's source/version is ./arch/x86/include/asm/cpuid, dated October 2026, and it's literally the for_each_cpuid_0x2_desc(9) page. Bye bestie, go switch on those types. π«Άβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms