Loading a native plugin gives it access to the application’s process. A bad pointer can corrupt application memory. A malicious plugin can use the application’s permissions.
Hyperlight offers another arrangement: run the code inside a small virtual machine and call its functions across that boundary.
My contributions add ARM64 backends for Windows Hypervisor Platform (WHP) and the Linux Microsoft Hypervisor interface (MSHV). To understand what these backends provide, it helps to start with what belongs inside the VM.
How small can a virtual machine be?
A conventional VM usually contains an operating system, virtual disks, and network devices. Applications run on top of that guest OS.
A microVM reduces the virtual hardware to suit a smaller workload. It can still run an operating system. Hyperlight takes the idea further: its normal guest contains application code and a small runtime, without a guest OS kernel.
The guest gets one virtual CPU and memory. It has no general-purpose filesystem or network device.
Host process
Application
Hyperlight library
|
| Hypervisor API
v
MicroVM
One virtual CPU
Guest memory
Guest runtime and application code
The hypervisor controls which memory the guest can access. The host supplies the backing pages, but a guest pointer does not grant access to an arbitrary address in the host process.
Hyperlight is the virtual machine monitor, or VMM. It loads the guest, configures the virtual CPU, and handles requests from the VM. The hypervisor provides the hardware isolation.
This is native execution. An ARM64 guest runs ARM64 instructions on an ARM64 processor.
A function call across a machine boundary
An application embeds Hyperlight as a library, supplies a guest binary, and calls exported guest functions. Guests are purpose-built using the Hyperlight Rust or C libraries.
The API resembles a function call, but the arguments and result cross a machine boundary. Hyperlight transfers the arguments, enters the VM, and lets the guest execute.
When the guest needs a host service, it calls a function explicitly exposed by the host. That might be a configuration lookup or a logging operation. The host decides which capabilities are available.
This is an important part of the security model. Exposing a function that reads any file the guest names grants that capability. Hardware isolation does not make an overly powerful host interface safe.
Guest state can persist across calls. Snapshots and restore let the application reuse a sandbox while returning its memory to a chosen state.
The design suits work that needs a CPU, memory, and a narrow host interface, rather than an entire guest OS.
ARM64 is not a single platform
The processor architecture defines instructions, registers, and page tables. The host platform defines the API through which an application controls a VM.
Hyperlight therefore needs separate backends:
| ARM64 host | Hypervisor interface |
|---|---|
| Windows | WHP backend, my contribution |
| Linux using the Microsoft hypervisor | MSHV backend, my contribution |
| Linux using KVM | Existing KVM support |
| macOS | Existing Hypervisor.framework support |
WHP and MSHV are different interfaces to the Microsoft hypervisor. KVM is Linux’s own virtualization interface. Supporting ARM64 instructions alone does not make these APIs interchangeable.
Each backend provides the same basic operations: create a VM, map memory, access registers, run the virtual CPU, and interpret why it stopped.
That last operation is called a VM exit. It returns control to the host when something needs the VMM’s attention, such as an I/O request or an invalid memory access.
Entering the VM means supplying CPU state
An ordinary function call runs in the caller’s execution environment. Entering a VM requires a separate environment: memory mappings, page tables, a stack, and register values.
For the first ARM64 guest entry, Hyperlight supplies:
| Register | Purpose |
|---|---|
PC |
Guest runtime entry point |
SP |
Initial stack pointer |
TTBR0_EL1 |
Guest page-table root |
X0 |
Random seed |
X1 |
Host page size |
X2 |
Guest log filter |
The runtime starts at guest exception level EL1. An operating system kernel normally runs at this level. Here, the small guest runtime occupies that role, with control over its own page tables and exception handling. EL1 inside the VM grants no privilege over the host kernel.
The CPU also needs to know how to interpret those page tables. TCR_EL1 selects the address-space and page-size configuration. MAIR_EL1 defines memory attributes. SCTLR_EL1 enables address translation and caches. A valid entry address is useful only when these settings agree with the guest’s memory layout.
Hyperlight represents CPU state independently of the backend. WHP and MSHV each translate that state into their own register identifiers and API representations. This includes floating-point and vector registers as well as the integer registers in the table.
On Windows, the host calls WHvRunVirtualProcessor. With MSHV, it issues the MSHV_RUN_VP ioctl through the virtual CPU’s file descriptor. The call returns when guest execution produces a VM exit.
The first run initializes the guest runtime and reports its dispatcher address to the host. Later calls start at that dispatcher, which reads the requested function and arguments from shared memory. Those arguments are separate from the startup values in X0 through X2.
Two translations make the memory boundary
A guest pointer passes through two address translations:
Guest virtual address
|
| Guest page tables
v
Guest physical address
|
| Hypervisor-controlled mappings
v
Host backing memory
The first translation gives the guest its own virtual address space. The second determines which memory that guest can actually reach.
The backend registers regions with the hypervisor: a guest physical address range, its host backing memory, and access permissions. This lets guest instructions operate directly on the supplied pages without copying memory through the VMM on every access.
Suppose the guest changes its page tables to point at a different physical address. That address is still a guest physical address. It must pass through the hypervisor’s mappings. It does not become an address in the host process.
This distinction explains why a runtime can execute at guest EL1 without owning the machine. The guest controls its inner translation. The host controls the outer boundary.
A guest without hardware interrupts
Hyperlight’s normal Rust and C guest runtime does not support handling asynchronous hardware interrupts. Guest code runs functions, not an operating system’s interrupt-driven device stack. A host keypress or device interrupt is not forwarded into the guest.
On ARM64, the runtime enters with IRQ and FIQ interrupts masked. Host services are explicit calls through the MMIO mechanism below. An intercepted write returns control to the host VMM, rather than invoking a guest interrupt handler.
Synchronous exceptions, such as a guest page fault, are separate. Masking IRQ and FIQ does not suppress faults caused by the guest’s own instructions.
Getting out through an MMIO doorbell
x86 has a separate I/O-port address space. A guest can execute an out instruction, which the hypervisor can intercept.
Hyperlight’s ARM64 runtime uses memory-mapped I/O, or MMIO. The guest’s page tables map a designated virtual I/O page to a reserved guest physical range. That physical range has no ordinary RAM backing in the hypervisor’s mappings, so an access returns control to the host.
Guest virtual address
|
| Guest page tables
v
Reserved guest physical I/O address
|
| Hypervisor intercept
v
Host receives a memory-access exit
The guest virtual mapping is valid. The missing RAM backing at the hypervisor level is intentional. An absent guest page-table mapping would instead cause a guest page fault.
Each logical I/O operation occupies an eight-byte slot in the page. The backend identifies the operation from the intercepted guest physical address:
operation = (access_address - io_page_address) / 8
For a host-function request, the larger request data lives in a shared-memory queue. The intercepted write acts as a doorbell telling the host to read that queue. Other operations carry a small payload in the write itself.
The syndrome describes the memory operation
Consider the guest’s debug-print operation. The I/O address says “print a character.” The value written there says which character to print.
The host needs that value, but there is no RAM cell at the intercepted address from which to read it. It must recover the value from the guest CPU. Which register supplied it, and how many bytes did the instruction write?
ARM provides an exception syndrome: encoded information about the operation that caused the exception. The hypervisor includes syndrome information in the memory-access exit. For a suitable store, the relevant fields are:
| Field | Bits | Meaning |
|---|---|---|
ISV |
24 | Instruction syndrome is valid |
WnR |
6 | The access is a write |
SRT |
20:16 | Source register number |
SAS |
23:22 | Access size: 1, 2, 4, or 8 bytes |
The register and size fields are usable only when ISV is set. These fields are documented in Arm’s exception syndrome register description.
For example, suppose the guest executes:
str x8, [x9]
Here X9 points to the debug-print slot, and X8 contains the character value. A syndrome such as 0x93c88047 identifies an eight-byte write from register 8. The backend extracts the fields with:
source_register = (syndrome >> 16) & 0x1f
access_size = 1 << ((syndrome >> 22) & 0x3)
The backend reads X8 through the hypervisor API and supplies the written bytes to Hyperlight’s request handler. The compiler can choose a different source register, so the backend must decode it rather than assume X8. A source register number of 31 denotes the zero register for this store, so the value is zero.
The address identifies the operation. The syndrome identifies the data transfer. Together, they let the backend handle the write without a general ARM instruction decoder.
For queue notifications, the handler ignores the written value and reads shared memory. The register value matters for operations such as debug printing and abort reporting, where the write carries data.
Resume the guest, or finish the call?
For a host-service request, Hyperlight handles the request and enters the VM again. The backend advances PC by the instruction length reported in the exit. For the four-byte STR above, the guest resumes at PC + 4.
Without that advancement, the symptom is a loop: the same instruction accesses the same I/O address, exits again, and never reaches the next instruction.
Completing a guest function uses a different logical operation on the same I/O page. The dispatcher publishes the function result in shared memory and writes to the completion slot. The backend translates that access into VmExit::Halt, which ends Hyperlight’s execution loop and returns control to the caller.
This completion signal is an MMIO store, not an ARM halt instruction. It also does not destroy the VM. The host can prepare another request and restart execution at the dispatcher.
An access outside the designated I/O range follows the memory-fault path rather than becoming a host request. Both a doorbell and a bad pointer can produce a memory-access exit. The backend’s address and access-type checks distinguish them.
What the ARM64 backends make possible
The WHP and MSHV backends extend Hyperlight’s function-oriented isolation model to Windows ARM64 and Linux ARM64 environments using the Microsoft hypervisor.
The application keeps the same basic model: supply a guest, expose selected host functions, and call into an isolated machine. The backend handles the platform’s register layouts, memory mappings, and exit mechanism.
That is the useful abstraction. The application works with functions and sandboxes. Underneath, the processor and hypervisor enforce the machine boundary.