diff --git a/src/dragonball/dbs_arch/src/x86_64/cpuid/brand_string.rs b/src/dragonball/dbs_arch/src/x86_64/cpuid/brand_string.rs index e9bc1df160..5dd04ffd6c 100644 --- a/src/dragonball/dbs_arch/src/x86_64/cpuid/brand_string.rs +++ b/src/dragonball/dbs_arch/src/x86_64/cpuid/brand_string.rs @@ -103,7 +103,7 @@ impl BrandString { /// of the host CPU. fn from_host_cpuid() -> Result { let mut this = Self::new(); - let mut cpuid_regs = unsafe { host_cpuid(0x8000_0000) }; + let mut cpuid_regs = host_cpuid(0x8000_0000); if cpuid_regs.eax < 0x8000_0004 { // Brand string not supported by the host CPU @@ -111,7 +111,7 @@ impl BrandString { } for leaf in 0x8000_0002..=0x8000_0004 { - cpuid_regs = unsafe { host_cpuid(leaf) }; + cpuid_regs = host_cpuid(leaf); this.set_reg_for_leaf(leaf, Reg::Eax, cpuid_regs.eax); this.set_reg_for_leaf(leaf, Reg::Ebx, cpuid_regs.ebx); this.set_reg_for_leaf(leaf, Reg::Ecx, cpuid_regs.ecx); diff --git a/src/dragonball/dbs_arch/src/x86_64/cpuid/common.rs b/src/dragonball/dbs_arch/src/x86_64/cpuid/common.rs index 292994a7b2..26e129cc5d 100644 --- a/src/dragonball/dbs_arch/src/x86_64/cpuid/common.rs +++ b/src/dragonball/dbs_arch/src/x86_64/cpuid/common.rs @@ -25,7 +25,7 @@ pub fn get_cpuid(function: u32, count: u32) -> Result { // TODO: replace with validation based on `has_cpuid()` when it becomes stable: // https://doc.rust-lang.org/core/arch/x86/fn.has_cpuid.html // this is safe because the host supports the `cpuid` instruction - let max_function = unsafe { __get_cpuid_max(function & leaf_0x80000000::LEAF_NUM).0 }; + let max_function = __get_cpuid_max(function & leaf_0x80000000::LEAF_NUM).0; if function > max_function { return Err(Error::InvalidParameters(format!( "Function not supported: 0x{function:x}", @@ -33,7 +33,7 @@ pub fn get_cpuid(function: u32, count: u32) -> Result { } // this is safe because the host supports the `cpuid` instruction - let entry = unsafe { __cpuid_count(function, count) }; + let entry = __cpuid_count(function, count); if entry.eax == 0 && entry.ebx == 0 && entry.ecx == 0 && entry.edx == 0 { return Err(Error::InvalidParameters(format!("Invalid count: {count}"))); }