Skip to content

Commit

Permalink
use the new x86 crate to solve issue hermit-os#30
Browse files Browse the repository at this point in the history
  • Loading branch information
stlankes committed Apr 30, 2020
1 parent 49c9dcd commit b53ff20
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

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

11 changes: 6 additions & 5 deletions src/arch/x86_64/kernel/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,12 @@ impl CpuFrequency {
match cpuid.get_tsc_info() {
Some(tsc_info) => {
// check if tsc_info provides a correct value
if tsc_info.denominator() != 0 {
let mhz = (tsc_info.tsc_frequency() / 1000000u64) as u16;
self.set_detected_cpu_frequency(mhz, CpuFrequencySources::CpuIdTscInfo)
} else {
Err(())
match tsc_info.tsc_frequency() {
Some(freq) => {
let mhz = (freq / 1000000u64) as u16;
self.set_detected_cpu_frequency(mhz, CpuFrequencySources::CpuIdTscInfo)
}
None => Err(())
}
}
None => Err(()),
Expand Down

0 comments on commit b53ff20

Please sign in to comment.