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

[WIP] Micro architecture parsing #177

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
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
9 changes: 6 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#[cfg(feature = "display")]
pub mod display;
mod extended;
pub mod uarch;
#[cfg(test)]
mod tests;

Expand Down Expand Up @@ -94,6 +95,7 @@
edx: result.edx,
}
}

/// The native reader uses the cpuid instruction to read the cpuid data from the
/// CPU we're currently running on directly.
#[derive(Clone, Copy)]
Expand All @@ -114,8 +116,8 @@

#[cfg(not(test))]
mod std {
pub use core::ops;

Check warning on line 119 in src/lib.rs

View workflow job for this annotation

GitHub Actions / Coverage

unused import: `core::ops`

Check warning on line 119 in src/lib.rs

View workflow job for this annotation

GitHub Actions / ci (stable)

unused import: `core::ops`

Check warning on line 119 in src/lib.rs

View workflow job for this annotation

GitHub Actions / ci (stable)

unused import: `core::ops`

Check warning on line 119 in src/lib.rs

View workflow job for this annotation

GitHub Actions / ci (nightly)

unused import: `core::ops`

Check warning on line 119 in src/lib.rs

View workflow job for this annotation

GitHub Actions / ci (nightly)

unused import: `core::ops`

Check warning on line 119 in src/lib.rs

View workflow job for this annotation

GitHub Actions / ci (nightly)

unused import: `core::ops`

Check warning on line 119 in src/lib.rs

View workflow job for this annotation

GitHub Actions / ci (nightly)

unused import: `core::ops`
pub use core::option;

Check warning on line 120 in src/lib.rs

View workflow job for this annotation

GitHub Actions / Coverage

unused import: `core::option`

Check warning on line 120 in src/lib.rs

View workflow job for this annotation

GitHub Actions / ci (stable)

unused import: `core::option`

Check warning on line 120 in src/lib.rs

View workflow job for this annotation

GitHub Actions / ci (stable)

unused import: `core::option`

Check warning on line 120 in src/lib.rs

View workflow job for this annotation

GitHub Actions / ci (nightly)

unused import: `core::option`

Check warning on line 120 in src/lib.rs

View workflow job for this annotation

GitHub Actions / ci (nightly)

unused import: `core::option`

Check warning on line 120 in src/lib.rs

View workflow job for this annotation

GitHub Actions / ci (nightly)

unused import: `core::option`

Check warning on line 120 in src/lib.rs

View workflow job for this annotation

GitHub Actions / ci (nightly)

unused import: `core::option`
}

/// Macro which queries cpuid directly.
Expand Down Expand Up @@ -185,16 +187,17 @@
}

impl<F> CpuIdReader for F
where
F: Fn(u32, u32) -> CpuIdResult + Clone,
where
F: Fn(u32, u32) -> CpuIdResult + Clone,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this from cargo fmt?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will check, but I would bet on my IDE running rustfmt. (JetBrain’s Rust Rover)

{
fn cpuid2(&self, eax: u32, ecx: u32) -> CpuIdResult {
self(eax, ecx)
}
}

#[non_exhaustive]
#[derive(Debug, Eq, PartialEq, Clone, Copy)]
enum Vendor {
pub enum Vendor {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should try to have docs for all public types

Intel,
Amd,
Unknown(u32, u32, u32),
Expand Down
Loading
Loading