#vm #os #amd64 #kvm #x86-64

nightly macro x86test-macro

Procedural macro plugin for x86test

5 releases

0.0.5 Mar 3, 2022
0.0.4 Jan 25, 2022
0.0.3 Apr 24, 2020
0.0.2 Sep 12, 2019
0.0.1 Aug 24, 2019

#568 in Procedural macros

Download history 35/week @ 2022-02-05 39/week @ 2022-02-12 46/week @ 2022-02-19 66/week @ 2022-02-26 43/week @ 2022-03-05 40/week @ 2022-03-12 79/week @ 2022-03-19 62/week @ 2022-03-26 47/week @ 2022-04-02 47/week @ 2022-04-09 48/week @ 2022-04-16 48/week @ 2022-04-23 90/week @ 2022-04-30 88/week @ 2022-05-07 133/week @ 2022-05-14 54/week @ 2022-05-21

380 downloads per month
Used in x86test

MIT/Apache

10KB
154 lines

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

~4MB
~59K SLoC