Skip to content

Commit 557cfbc

Browse files
committed
fix(instructions): allow unused_unsafe for cpuid
1 parent 14aaecc commit 557cfbc

3 files changed

Lines changed: 4 additions & 0 deletions

File tree

src/instructions/random.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ impl RdRand {
1010
pub fn new() -> Option<Self> {
1111
// RDRAND support indicated by CPUID page 01h, ecx bit 30
1212
// https://en.wikipedia.org/wiki/RdRand#Overview
13+
#[allow(unused_unsafe)]
1314
let cpuid = unsafe { core::arch::x86_64::__cpuid(0x1) };
1415
if cpuid.ecx & (1 << 30) != 0 {
1516
Some(RdRand(()))

src/instructions/smap.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ impl Smap {
3535
/// CR4.
3636
pub fn new() -> Option<Self> {
3737
// Check if the CPU supports `stac` and `clac`.
38+
#[allow(unused_unsafe)]
3839
let cpuid = unsafe { core::arch::x86_64::__cpuid(7) };
3940
if cpuid.ebx.get_bit(20) {
4041
Some(Self(()))

src/instructions/tlb.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ impl Invlpgb {
160160
assert_eq!(cs.rpl(), PrivilegeLevel::Ring0);
161161

162162
// Check if the `INVLPGB` and `TLBSYNC` instruction are supported.
163+
#[allow(unused_unsafe)]
163164
let cpuid = unsafe { core::arch::x86_64::__cpuid(0x8000_0008) };
164165
if !cpuid.ebx.get_bit(3) {
165166
return None;
@@ -169,6 +170,7 @@ impl Invlpgb {
169170
let invlpgb_count_max = cpuid.edx.get_bits(0..=15) as u16;
170171

171172
// Figure out the number of supported ASIDs.
173+
#[allow(unused_unsafe)]
172174
let cpuid = unsafe { core::arch::x86_64::__cpuid(0x8000_000a) };
173175
let nasid = cpuid.ebx;
174176

0 commit comments

Comments
 (0)