Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions src/hal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,27 @@ impl Hal for X64Hal {
}

fn asm_cpuid(&self, function: u32) -> CpuidResult {
__cpuid(function)
// SAFETY: The `cpuid` instruction is guaranteed to be supported on all x86_64 processors.
//
// `#[allow(unused_unsafe)]` is used here to simultaneously support Rust <= 1.93 toolchains
// that consider __cpuid unsafe and Rust >= 1.94 (or >= nightly-2025-12-27) toolchains that
// consider __cpuid safe.
#[allow(unused_unsafe)]
Comment thread
kouchekiniad marked this conversation as resolved.
unsafe {
Comment thread
kouchekiniad marked this conversation as resolved.
__cpuid(function)
}
}

fn asm_cpuid_ex(&self, function: u32, sub_function: u32) -> CpuidResult {
__cpuid_count(function, sub_function)
// SAFETY: The `cpuid` instruction is guaranteed to be supported on all x86_64 processors.
//
// `#[allow(unused_unsafe)]` is used here to simultaneously support Rust <= 1.93 toolchains
// that consider __cpuid_count unsafe and Rust >= 1.94 (or >= nightly-2025-12-27) toolchains
// that consider __cpuid_count safe.
#[allow(unused_unsafe)]
unsafe {
__cpuid_count(function, sub_function)
}
}
}

Expand Down
Loading