Skip to content

Commit

Permalink
Always use core::arch
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasf committed Jan 15, 2021
1 parent 72492c8 commit baf21c4
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 75 deletions.
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

0 comments on commit baf21c4

Please sign in to comment.