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

Always use core::arch #38

Merged
merged 1 commit into from Jan 20, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 0 additions & 5 deletions Cargo.toml
Expand Up @@ -2,7 +2,6 @@
name = "raw-cpuid"
version = "8.1.2"
authors = ["Gerd Zellweger <mail@gerdzellweger.com>"]
build = "build.rs"
edition = "2018"

description = "A library to parse the x86 CPUID instruction, written in rust with no external dependencies. The implementation closely resembles the Intel CPUID manual description. The library does only depend on libcore."
Expand Down Expand Up @@ -33,7 +32,3 @@ serde_derive = {version = "1.0", optional = true }
libc = { version = "0.2", default-features = false }
core_affinity = "0.5.10"
rustversion = "1.0"

[build-dependencies]
rustc_version = "0.3"
cc = "1"
16 changes: 0 additions & 16 deletions build.rs

This file was deleted.

32 changes: 0 additions & 32 deletions src/cpuid.c

This file was deleted.

22 changes: 0 additions & 22 deletions src/lib.rs
Expand Up @@ -15,29 +15,7 @@ extern crate serde_derive;
#[macro_use]
extern crate bitflags;

/// Provides `cpuid` on stable by linking against a C implementation.
#[cfg(not(feature = "use_arch"))]
pub mod native_cpuid {
use super::CpuIdResult;

extern "C" {
fn cpuid(a: *mut u32, b: *mut u32, c: *mut u32, d: *mut u32);
}

pub fn cpuid_count(mut eax: u32, mut ecx: u32) -> CpuIdResult {
let mut ebx = 0u32;
let mut edx = 0u32;

unsafe {
cpuid(&mut eax, &mut ebx, &mut ecx, &mut edx);
}

CpuIdResult { eax, ebx, ecx, edx }
}
}

/// Uses Rust's `cpuid` function from the `arch` module.
#[cfg(feature = "use_arch")]
pub mod native_cpuid {
use super::CpuIdResult;

Expand Down