#msr #x86-64 #cpu #linux #read-write

msru

A Rust-safe library for interracting with Model Specific Registers in user-space

2 unstable releases

0.2.0 May 25, 2023
0.1.0 May 19, 2023

#783 in Unix APIs

Download history 1549/week @ 2024-11-18 421/week @ 2024-11-25 644/week @ 2024-12-02 589/week @ 2024-12-09 459/week @ 2024-12-16 95/week @ 2024-12-23 61/week @ 2024-12-30 314/week @ 2025-01-06 412/week @ 2025-01-13 526/week @ 2025-01-20 472/week @ 2025-01-27 508/week @ 2025-02-03 674/week @ 2025-02-10 847/week @ 2025-02-17 951/week @ 2025-02-24 496/week @ 2025-03-03

2,984 downloads per month
Used in 3 crates

Apache-2.0

7KB
71 lines

msru

msru provides a Rust-friendly interface for x86_64 CPU MSRs (Model Specific Registers). It allows you to read and write to MSRs via a specified CPU msr device file (/dev/cpu/{cpu_number}/msr).

Installation

Add the following line to your Cargo.toml file:

[dependencies]
msru = "0.2.0"

Usage

use msru::Msr;

// X86_64 SYSCFG MSR
let msr: Msr = Msr::new(0xC0010010, 0)?;

let raw_value: u64 = msr.read()?;

// ...

lib.rs:

As most of the existing crates require kernel-mode, this provides a Rust-friendly interface for reading and writing to MSRs while in user-space. This does require the msr kernel module to be loaded.

Currently this crate only supports Linux.

No runtime deps