5 releases

Uses new Rust 2021

0.2.0 May 1, 2022
0.0.12 Dec 29, 2019
0.0.11 Dec 29, 2019
0.0.10 Dec 29, 2019
0.0.9 Dec 28, 2019

#29 in macOS and iOS APIs

Download history 86/week @ 2022-06-08 53/week @ 2022-06-15 58/week @ 2022-06-22 104/week @ 2022-06-29 46/week @ 2022-07-06 164/week @ 2022-07-13 161/week @ 2022-07-20 216/week @ 2022-07-27 63/week @ 2022-08-03 147/week @ 2022-08-10 59/week @ 2022-08-17 48/week @ 2022-08-24 31/week @ 2022-08-31 28/week @ 2022-09-07 71/week @ 2022-09-14 44/week @ 2022-09-21

175 downloads per month
Used in uhyve

MIT license

86KB
1.5K SLoC

xhypervisor

crates.io Docs.rs License

xhypervisor is a Rust library that taps into functionality that enables hardware-accelerated execution of virtual machines on OS X. It is a fork of hypervisor-rs and modified for the development of uhyve and ehyve. Derived from ahv, we added the support of Apple's Hypervisor Framework on Apple Silicon.

It binds to the Hypervisor framework on OS X, and exposes a safe Rust interface through the hypervisor module, and an unsafe foreign function interface through the xhypervisor::ffi module.

A xhypervisor derived from the 16 bits VM is used as test example, which was original published in blog post http://www.pagetable.com/?p=764.

Prerequisites

To use this library, you need

  • OS X Yosemite (10.10), or newer

  • a Intel processor with the VT-x feature or an Apple Silicon processor with virtualization support. To verify this, run and expect the following in your Terminal:

    $ sysctl kern.hv_support
    kern.hv_support: 1
    

Status

  • WARNING: The Apple Silicon support is in an early state
  • Accessing x86 registers
  • Accessing aarch64 registers
  • x86: Accessing model-specific registers (MSRs)
  • Mapping guest physical memory segments into guest physical address space
  • Virtual CPUs
    • Executing and interrupting
    • Force flushing cached state
    • Invalidating translation lookaside buffer (TLB)
    • Accessing floating point (FP) and SIMD state
    • Obtaining cumulative execution time
    • Synchronizing guest timestamp-counters (TSC)
  • x86: Accessing fields of Virtual Machine Control Structures (VMCS)

Dependencies

~230–680KB
~16K SLoC