Skip to content

hypervisor 0.1.0

Choose a tag to compare

@sauravsc sauravsc released this 27 Nov 21:06
· 3 commits to master since this release
f7cc606

This is the first release in ten years. It adds Apple silicon support, moves to a modern toolchain, and fixes the Intel API.

Highlights

  • Apple silicon (arm64) support through a safe API:
    • Vm is the per-process VM.
    • GuestMemory is page-aligned memory that stays mapped for its whole lifetime.
    • Vcpu is !Send, because a vCPU belongs to the thread that created it. VcpuHandle stops a vCPU from any thread.
    • Also covered: GPR, SIMD&FP and system registers, exit and exception decoding (hvc/brk, MMIO data aborts, trapped sysregs), IRQ/FIQ injection, debug traps, the virtual timer and VcpuConfig.
  • Intel API kept (x86_64 only), with every call returning Result (#2).
  • Entitlement support: entitlements.plist and scripts/run-signed.sh sign binaries with com.apple.security.hypervisor. The repo uses the script as its cargo runner.
  • Examples for both architectures (#1), plus runtime tests that run real guests on Apple silicon. CI also runs the Intel example and test on a VT-x runner.
  • Edition 2024, MSRV 1.85, GitHub Actions CI, and documentation on docs.rs.

Breaking changes

  • Functions return Result<T, hypervisor::Error>. Error no longer has a Success variant, and its variants were renamed (BadArgument, NoResources, NoDevice, Unsupported, Generic).
  • map_mem is unsafe.
  • The Intel API only exists when building for x86_64.

Fixes

  • vCPU::write_msr wrote a pointer instead of the value into the MSR.

Thanks

  • @stlankes for #2 (Result-based error handling and warning fixes), and for helping in #1.
  • @orklann for #1, which led to the examples.

See CHANGELOG.md for details.