Skip to content
Rust library to use x86 (amd64) specific functionality and registers.
Rust Other
  1. Rust 99.0%
  2. Other 1.0%
Branch: master
Clone or download
edigaryev and gz Inline vmresume() and vmlaunch()
In #56's discussion I noted that "there are no strong reasons to use inline for
VMX intrinsics".

I was wrong: it's practically impossible to use `x86::bits64::vmx::vmresume()`
due to it being a function. The reason is that VMRESUME is usually called after
restoring the guest state, which includes stack pointer.

As the stack pointer now corresponds to guest address space and CALL to
`x86::bits64::vmx::vmresume()` accesses the stack, this results in triple fault

`x86::bits64::vmx::vmlaunch()` was also inlined because in practice it has
similar pitfalls, and even through they can be avoided, an inlined version of
this function is less surprising.
Latest commit 5bba760 Oct 14, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
ci Add link Sep 10, 2019
src Inline vmresume() and vmlaunch() Oct 14, 2019
tests Update testing infrastructure, add x86test for Sep 10, 2019
x86data/perfmon_data Update perfmondb. Apr 15, 2019
x86test Update Sep 13, 2019
.gitignore Fixed typo in gitignore Aug 20, 2019
AUTHORS Bump version. Aug 12, 2019
Cargo.toml Update IRQ add vector constants. Oct 12, 2019
LICENSE Crudely throw everything together Jun 29, 2016 Mention Intel VMX support in Sep 26, 2019 update build dependencies May 31, 2019
rust-toolchain Set default toolchain to nightly Aug 20, 2019 Update perfmon script. Sep 18, 2016

x86 / amd64 library Build Status

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.


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


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


You can’t perform that action at this time.