crate::ix!();
#[inline]
pub fn getcpuid(
leaf: u32,
subleaf: u32,
a: &mut u32,
b: &mut u32,
c: &mut u32,
d: &mut u32,
) {
trace!(
target: "compat::cpuid",
leaf = leaf,
subleaf = subleaf,
"enter getcpuid"
);
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
{
unsafe {
#[cfg(target_arch = "x86")]
use core::arch::x86::__cpuid_count as __cpuid_count_inner;
#[cfg(target_arch = "x86_64")]
use core::arch::x86_64::__cpuid_count as __cpuid_count_inner;
let r = __cpuid_count_inner(leaf, subleaf);
*a = r.eax;
*b = r.ebx;
*c = r.ecx;
*d = r.edx;
}
}
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
{
warn!(
target: "compat::cpuid",
"getcpuid invoked on unsupported architecture – zeroing outputs"
);
*a = 0;
*b = 0;
*c = 0;
*d = 0;
}
trace!(
target: "compat::cpuid",
eax = *a,
ebx = *b,
ecx = *c,
edx = *d,
"exit getcpuid"
);
}