• Stars
    star
    139
  • Rank 262,954 (Top 6 %)
  • Language
    Rust
  • License
    MIT License
  • Created over 9 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

cpuid library in rust.

cpuid Crates.io Standard checks

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 works in no_std environments. Some additional cargo features require std (e.g., pretty printing, serialization).

  • For Intel platforms: The code should be in sync with the March 2018 revision of the Intel Architectures SDM.
  • For AMD platforms it should be in sync with the AMD64 systems manual no. 24594, Revision 3.32 (March 2021).

Library usage

use raw_cpuid::CpuId;
let cpuid = CpuId::new();

if let Some(vf) = cpuid.get_vendor_info() {
    assert!(vf.as_str() == "GenuineIntel" || vf.as_str() == "AuthenticAMD");
}

let has_sse = cpuid.get_feature_info().map_or(false, |finfo| finfo.has_sse());
if has_sse {
    println!("CPU supports SSE!");
}

if let Some(cparams) = cpuid.get_cache_parameters() {
    for cache in cparams {
        let size = cache.associativity() * cache.physical_line_partitions() * cache.coherency_line_size() * cache.sets();
        println!("L{}-Cache size is {}", cache.level(), size);
    }
} else {
    println!("No cache parameter information available")
}

cpuid binary

raw-cpuid ships with a cpuid binary that can be installed to inspect the output of the CPUID instruction on a host system.

To install, use:

cargo install raw-cpuid --features cli

The cli feature is currently required to build the binary version due to cargo limitations.

Documentation

More Repositories

1

rust-x86

Rust library to use x86 (amd64) specific functionality and registers.
Rust
303
star
2

rust-elfloader

Library to load and relocate ELF files.
Rust
108
star
3

autoperf

Simplify the use of performance counters.
Rust
63
star
4

rust-perfcnt

Rust library to program hardware performance counter.
Rust
49
star
5

rust-slabmalloc

Simple malloc implementation.
Rust
30
star
6

rust-multiboot

Multiboot library written in rust.
Rust
20
star
7

rust-uio

Linux UIO Library in Rust
Rust
17
star
8

contextswitch

Quantifying the cost of context switch
C
15
star
9

phdplot

Make nice plots with matplotlib.
Python
11
star
10

rust-raytracer

Raytracers in Rust.
Rust
9
star
11

rust-lkl

Wrapper to use the Linux LKL library in Rust
Rust
6
star
12

node-replication

Rust
5
star
13

rust-ext2

Rust
4
star
14

urcu-sys

Rust bindings for user-space RCU (https://github.com/urcu/userspace-rcu)
Rust
4
star
15

rust-driverkit

driverkit
Rust
4
star
16

backtracer

Simple backtrace support for no-std rust
Rust
4
star
17

rust-ahci

Rust
3
star
18

sv6

C
3
star
19

netlat

Rust
3
star
20

rust-topology

x86 hardware topology abstraction
Rust
3
star
21

rust-processortrace

Rust driver for Intel processor trace.
Rust
3
star
22

cslab

Code for Computer Systems Lab - Assignments
C
3
star
23

vmopsbench

C
2
star
24

rust-klogger

Kernel logging library in rust.
Rust
2
star
25

website

Personal website
TeX
2
star
26

acpica-sys

Rust bindings for acpica C library.
C
1
star
27

corealloc

CLI utility tool to allocate cores.
Rust
1
star
28

Index

Practice implementation of a hash table. Documentation: https://harmedchronogram.github.io/Index/docs/index/
Rust
1
star
29

rust-rumpkernel

Rumpkernel for use in rust projects.
Rust
1
star
30

aos10

Advanced Operating System 2010
C
1
star
31

termcodes

ANSI style escape codes
Rust
1
star
32

scfs

A state centric file-system
Rust
1
star
33

rust-workshop

Rust workshop material for DevPulseCon 2020/2021
Rust
1
star