diff --git a/src/arch/x86_64/cpuid.rs b/src/arch/x86_64/cpuid.rs deleted file mode 100644 index 0901c7ab2a..0000000000 --- a/src/arch/x86_64/cpuid.rs +++ /dev/null @@ -1,13 +0,0 @@ -use raw_cpuid::{ExtendedFeatures, FeatureInfo}; - -pub use crate::arch::x86_shared::cpuid::*; - -pub fn feature_info() -> FeatureInfo { - cpuid() - .get_feature_info() - .expect("x86_64 requires CPUID leaf=0x01 to be present") -} - -pub fn has_ext_feat(feat: impl FnOnce(ExtendedFeatures) -> bool) -> bool { - cpuid().get_extended_feature_info().map_or(false, feat) -} diff --git a/src/arch/x86_64/mod.rs b/src/arch/x86_64/mod.rs index f0cb6590ea..e790360f50 100644 --- a/src/arch/x86_64/mod.rs +++ b/src/arch/x86_64/mod.rs @@ -8,9 +8,6 @@ pub mod macros; /// Constants like memory locations pub mod consts; -/// CPUID wrapper -pub mod cpuid; - /// Global descriptor table pub mod gdt; diff --git a/src/arch/x86_shared/cpuid.rs b/src/arch/x86_shared/cpuid.rs index 25b2859841..7339a1daf7 100644 --- a/src/arch/x86_shared/cpuid.rs +++ b/src/arch/x86_shared/cpuid.rs @@ -1,4 +1,4 @@ -use raw_cpuid::{CpuId, CpuIdResult}; +use raw_cpuid::{CpuId, CpuIdResult, ExtendedFeatures, FeatureInfo}; pub fn cpuid() -> CpuId { // FIXME check for cpuid availability during early boot and error out if it doesn't exist. @@ -15,3 +15,15 @@ pub fn cpuid() -> CpuId { } }) } + +#[cfg_attr(not(target_arch = "x86_64"), expect(dead_code))] +pub fn feature_info() -> FeatureInfo { + cpuid() + .get_feature_info() + .expect("x86_64 requires CPUID leaf=0x01 to be present") +} + +#[cfg_attr(not(target_arch = "x86_64"), expect(dead_code))] +pub fn has_ext_feat(feat: impl FnOnce(ExtendedFeatures) -> bool) -> bool { + cpuid().get_extended_feature_info().map_or(false, feat) +}