#cpuid #x86 #amd64 #os #libcore

bin+lib raw-cpuid

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.

30 releases (stable)

8.1.2 Oct 22, 2020
8.1.1 Jul 3, 2020
8.1.0 May 15, 2020
7.0.3 Sep 8, 2019
0.0.2 Mar 24, 2015

#1 in Hardware support

Download history 10774/week @ 2020-08-11 13274/week @ 2020-08-18 12970/week @ 2020-08-25 11625/week @ 2020-09-01 15545/week @ 2020-09-08 14402/week @ 2020-09-15 15109/week @ 2020-09-22 13343/week @ 2020-09-29 15376/week @ 2020-10-06 16540/week @ 2020-10-13 17790/week @ 2020-10-20 20235/week @ 2020-10-27 18653/week @ 2020-11-03 17989/week @ 2020-11-10 21706/week @ 2020-11-17 15579/week @ 2020-11-24

57,633 downloads per month
Used in 126 crates (23 directly)

MIT license

180KB
4.5K SLoC

cpuid Build Status Crates.io

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.

The code should be in sync with the latest March 2018 revision of the Intel Architectures Software Developer’s Manual.

Library usage

let cpuid = CpuId::new();

match cpuid.get_vendor_info() {
    Some(vf) => assert!(vf.as_string() == "GenuineIntel"),
    None => ()
}

let has_sse = match cpuid.get_feature_info() {
    Some(finfo) => finfo.has_sse(),
    None => false
};

if has_sse {
    println!("CPU supports SSE!");
}

match cpuid.get_cache_parameters() {
    Some(cparams) => {
        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);
        }
    },
    None => println!("No cache parameter information available"),
}

Documentation

Dependencies

~16–375KB