#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.

32 releases (stable)

9.0.0 Jan 21, 2021
8.1.2 Oct 22, 2020
8.1.1 Jul 3, 2020
7.0.4 Dec 21, 2020
0.0.2 Mar 24, 2015

#6 in Hardware support

Download history 22380/week @ 2021-02-21 23527/week @ 2021-02-28 23131/week @ 2021-03-07 22808/week @ 2021-03-14 20705/week @ 2021-03-21 20146/week @ 2021-03-28 19332/week @ 2021-04-04 17847/week @ 2021-04-11 20420/week @ 2021-04-18 23774/week @ 2021-04-25 20371/week @ 2021-05-02 22421/week @ 2021-05-09 22748/week @ 2021-05-16 22091/week @ 2021-05-23 18938/week @ 2021-05-30 21498/week @ 2021-06-06

91,154 downloads per month
Used in 157 crates (25 directly)

MIT license

175KB
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

~14–250KB