Move arch::x86_64::cpuid into arch::x86_shared::cpuid

This commit is contained in:
bjorn3
2025-09-10 18:35:36 +02:00
parent ad6c6c5e41
commit 1268472103
3 changed files with 13 additions and 17 deletions
-13
View File
@@ -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)
}
-3
View File
@@ -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;
+13 -1
View File
@@ -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)
}