#userspace #x86-64 #msr #x86-64-linux #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

#7 in #x86-64-linux

Download history 949/week @ 2025-02-23 506/week @ 2025-03-02 849/week @ 2025-03-09 679/week @ 2025-03-16 692/week @ 2025-03-23 333/week @ 2025-03-30 492/week @ 2025-04-06 456/week @ 2025-04-13 347/week @ 2025-04-20 499/week @ 2025-04-27 509/week @ 2025-05-04 346/week @ 2025-05-11 381/week @ 2025-05-18 257/week @ 2025-05-25 464/week @ 2025-06-01 380/week @ 2025-06-08

1,491 downloads per month
Used in 3 crates

Apache-2.0

7KB
71 lines

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.


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()?;

// ...

No runtime deps