Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to raw-cpuid 11 #505

Merged
merged 1 commit into from
May 5, 2023
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ xhypervisor = "0.2"

[target.'cfg(target_arch = "x86_64")'.dependencies]
x86_64 = { version = "0.14", default-features = false }
raw-cpuid = "10.7"
raw-cpuid = "11"

[target.'cfg(target_arch = "aarch64")'.dependencies]
bitflags = "2.2"
Expand Down
8 changes: 5 additions & 3 deletions src/arch/x86_64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::{
};

use log::{debug, warn};
use raw_cpuid::CpuId;
use raw_cpuid::{CpuId, CpuIdReaderNative};

pub const RAM_START: u64 = 0x00;
const MHZ_TO_HZ: u64 = 1000000;
Expand All @@ -24,7 +24,9 @@ impl std::fmt::Display for FrequencyDetectionFailed {

impl std::error::Error for FrequencyDetectionFailed {}

pub fn detect_freq_from_cpuid(cpuid: &CpuId) -> std::result::Result<u32, FrequencyDetectionFailed> {
pub fn detect_freq_from_cpuid(
cpuid: &CpuId<CpuIdReaderNative>,
) -> std::result::Result<u32, FrequencyDetectionFailed> {
debug!("Trying to detect CPU frequency by tsc info");

let has_invariant_tsc = cpuid
Expand Down Expand Up @@ -65,7 +67,7 @@ pub fn detect_freq_from_cpuid(cpuid: &CpuId) -> std::result::Result<u32, Frequen
}

pub fn detect_freq_from_cpuid_hypervisor_info(
cpuid: &CpuId,
cpuid: &CpuId<CpuIdReaderNative>,
) -> std::result::Result<u32, FrequencyDetectionFailed> {
debug!("Trying to detect CPU frequency by hypervisor info");
let hypervisor_info = cpuid
Expand Down