Skip to main content

cpuid_consistent

Function cpuid_consistent 

Source
pub open spec fn cpuid_consistent(
    model: CpuFeatureModel,
    leaf: u32,
    subleaf: u32,
    result: CpuidResult,
) -> bool
Expand description
{
    subleaf == 0 && leaf <= model.max_basic_leaf
        ==> match leaf {
            0 => result.eax == model.max_basic_leaf,
            1 => (
                &&& model.supports_avx == (result.ecx & (1u32 << 28) != 0)
                &&& model.supports_xapic == (result.edx & (1u32 << 9) != 0)
                &&& model.supports_x2apic == (result.ecx & (1u32 << 21) != 0)

            ),
            7 => model.supports_avx512f == (result.ebx & (1u32 << 16) != 0),
            0x15 => {
                (result.eax, result.ebx, result.ecx)
                    == (model.tsc_denominator, model.tsc_numerator, model.crystal_hz)
            }
            _ => true,
        }
}

Whether result, read at (leaf, subleaf), agrees with model.

Fixes the maximum basic leaf, the modeled feature bits and the TSC calibration fields of leaf 0x15. The base frequency in leaf 0x16 is scoped to a logical processor (Intel SDM Vol. 1, Table 21-54).