#os #amd64 #x86 #x86-64 #ia32

nightly x86

Library to program x86 (amd64) hardware. Contains x86 specific data structure descriptions, data-tables, as well as convenience function to call assembly instructions typically not exposed in higher level languages.

48 releases (27 breaking)

✓ Uses Rust 2018 edition

new 0.27.0 Oct 12, 2019
0.25.0 Sep 26, 2019
0.19.0 May 31, 2019
0.15.1 Feb 15, 2019
0.0.1 Mar 28, 2015

#7 in Operating systems

Download history 540/week @ 2019-06-29 802/week @ 2019-07-06 419/week @ 2019-07-13 464/week @ 2019-07-20 411/week @ 2019-07-27 319/week @ 2019-08-03 453/week @ 2019-08-10 771/week @ 2019-08-17 487/week @ 2019-08-24 331/week @ 2019-08-31 420/week @ 2019-09-07 219/week @ 2019-09-14 1063/week @ 2019-09-21 235/week @ 2019-09-28 449/week @ 2019-10-05

1,975 downloads per month
Used in 12 crates (9 directly)

MIT license

2MB
6K SLoC

x86 / amd64 library Build Status Crates.io docs.rs/x86

Library to program x86 (amd64) hardware. Contains x86 specific data structure descriptions, data-tables, as well as convenience function to call assembly instructions typically not exposed in higher level languages.

Currently supports:

  • I/O registers
  • Control registers
  • MSR registers
  • Segmentation
  • Descriptor-tables (GDT, LDT, IDT)
  • IA32-e page table layout
  • Interrupts (with xAPIC and x2APIC, I/O APIC drivers)
  • Task state
  • Performance counter information
  • Intel SGX: Software Guard Extensions
  • Random numbers (rdrand, rdseed)
  • Time (rdtsc, rdtscp)
  • Querying CPUID (uses raw_cpuid library)
  • Transactional memory (Intel RTM and HLE)
  • Virtualization (Intel VMX)

This library depends on libcore so it can be used in kernel level code.

Testing

We use two forms of tests for the crate. Regular tests with #[test] that run in a ring 3 process and #[x86test] tests that run in a VM (and therefore grant a privileged execution environment, see x86test).

# To execute x86tests run:
$ RUSTFLAGS="-C relocation-model=dynamic-no-pic -C code-model=kernel" RUST_BACKTRACE=1 cargo test --features vmtest

# To execute the regular tests, run:
$ cargo test --features utest

Features

  • performance-counter: Includes the performance counter information. Note this feature can increase compilation time significantly due to large, statically generated hash-tables that are included in the source. Therefore, it is disabled by default.

Documentation

Dependencies