A minimal Virtual Machine Monitor (VMM) for macOS on Apple Silicon using the Hypervisor.framework. This was inspired by the Using the KVM API article, which provides a similar example for KVM on Linux.
It demonstrates how to:
- Initialize a Virtual Machine.
- Create and configure a VCPU.
- Map guest memory.
- Execute ARM64 guest code.
- Handle VM exits.
- An Apple Silicon Mac.
- macOS 11.0 or later.
- Xcode Command Line Tools installed (
xcode-select --install).
The binary must be signed with the com.apple.security.hypervisor entitlement to run. The provided Makefile handles the compilation and codesigning automatically.
make./hv_simpleExpected Output:
4
Guest halted.This project is licensed under the MIT License - see the LICENSE file for details.