#x86-64 #intel-sgx #higher-level #data-structures #transactional-memory #ia32

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.

74 releases (breaking)

0.52.0 Oct 18, 2022
0.51.0 Jul 15, 2022
0.50.0 Jun 30, 2022
0.47.0 Mar 3, 2022
0.0.1 Mar 28, 2015

#64 in Hardware support

Download history 6560/week @ 2024-07-21 6368/week @ 2024-07-28 5727/week @ 2024-08-04 4926/week @ 2024-08-11 4685/week @ 2024-08-18 5556/week @ 2024-08-25 5498/week @ 2024-09-01 5741/week @ 2024-09-08 4853/week @ 2024-09-15 7586/week @ 2024-09-22 6658/week @ 2024-09-29 8495/week @ 2024-10-06 14003/week @ 2024-10-13 14488/week @ 2024-10-20 12329/week @ 2024-10-27 11079/week @ 2024-11-03

52,924 downloads per month
Used in 47 crates (29 directly)

MIT license

2MB
8K SLoC

Contains (Zip file, 670KB) x86data/perfmon_data/TMA_Metrics.xlsx

x86 / amd64 library Crates.io docs.rs/x86 Standard checks

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
  • Debug 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