Integrate WHP and macOS HVF support - #2
Merged
Merged
Conversation
- native/hvf_backend.cc: full ARM64 VMM using Apple Hypervisor.framework (macOS 15+): GICv3, PL011 UART, virtio-mmio block, virtio-mmio net via vmnet.framework shared mode (NAT). Includes FDT/DTB builder, ARM64 Image loader, ESR decode, PSCI/HVC emulation, and WFI yield. - binding.gyp: add darwin/arm64 target linking Hypervisor + vmnet + CoreFoundation - src/native.ts: add HvfProbeResult, HvfRunConfig, NativeHvfBackend - src/kvm.ts: add probeHvf, runHvfVm, hvfDefaultKernelCmdline (PL011/virtio-mmio) - src/index.ts: hostBackend() returns "hvf" on darwin; featureLines and doctor() are HVF-aware; run/start paths dispatch to HVF on macOS - src/net.ts: --net auto on darwin returns vmnet:shared sentinel instead of requiring ip/iptables - scripts/build-native.mjs: add darwin/arm64 to supported platforms - test/unit.test.ts: guard Linux-only assertions behind platform checks
There was a problem hiding this comment.
Pull request overview
This PR expands node-vmm to support additional host backends (Windows/WHP and macOS/HVF) and broadens the CLI/SDK surface around networking and disk/rootfs workflows, including prebuilt rootfs and new packaging/release automation.
Changes:
- Add/extend cross-platform networking + disk/rootfs capabilities (slirp, persistent/explicit disks, attached disks, prebuilt rootfs).
- Introduce macOS/HVF (arm64) runtime support and Windows/WHP runtime refactor with new native modules/devices.
- Update build/packaging scripts and CI/release workflows to ship Linux/Windows/macOS prebuilds and release rootfs assets.
Reviewed changes
Copilot reviewed 89 out of 108 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| vcpkg.json | Adds vcpkg manifest for Windows-native dependency management (libslirp/glib). |
| third_party/libslirp/lib/x64-windows/libslirp.exp | Adds Windows libslirp export artifact. |
| third_party/libslirp/lib/x64-windows/libslirp.def | Adds DEF file describing libslirp exported symbols. |
| third_party/libslirp/include/libslirp-version.h | Adds vendored libslirp version header for consumers/builds. |
| test/ext4.test.ts | Adds scaffold/contract tests for the new ext4 writer stubs. |
| src/types.ts | Extends public SDK types for backends, networking modes, progress events, disks, and prebuilt rootfs modes. |
| src/rootfs-linux.ts | Adds Linux rootfs build implementation (mount/chroot/unshare path). |
| src/rootfs-darwin.ts | Adds macOS rootfs build implementation (mkfs.ext4 discovery + OCI extraction). |
| src/process.ts | Improves runCommand coverage annotations and makes commandExists() Windows-aware (where.exe). |
| src/oci.ts | Adds blob download progress plumbing and reporting during OCI pulls. |
| src/net.ts | Adds slirp networking mode and macOS HVF networking backend selection logic. |
| src/kernel.ts | Refactors kernel naming/lookup to support ARM64 kernels (esp. macOS/HVF) while keeping legacy aliases. |
| src/ext4/writer.ts | Introduces Ext4ImageWriter scaffold API (currently stubbed via NotImplementedError). |
| src/ext4/types.ts | Defines ext4 writer types (entries, inode modes, options, finalize result). |
| src/ext4/superblock.ts | Adds superblock constants/types + stub planning/serialization. |
| src/ext4/inode.ts | Adds inode/inode-table scaffolding types + stubs. |
| src/ext4/index.ts | Adds ext4 module public re-exports under src/ext4. |
| src/ext4/group.ts | Adds group descriptor table scaffolding + stubs. |
| src/ext4/dir.ts | Adds directory writer scaffolding + stubs, plus record-length helper. |
| src/ext4/bitmap.ts | Adds bitmap scaffolding + stubs plus group bitmap factory helper. |
| src/disk.ts | Adds persistent/explicit root disk materialization + attached disk resolution/validation helpers. |
| scripts/vendor-libslirp.mjs | Adds Windows-only libslirp vendor script (MSYS2 download + DEF/implib generation). |
| scripts/slirp-flags.mjs | Adds pkg-config helper to supply slirp/glib flags for macOS builds. |
| scripts/package-prebuild.mjs | Extends prebuild packaging for Windows DLL staging and macOS dylib bundling/rewrite/codesign. |
| scripts/pack-check.mjs | Hardens npm pack checks across platforms and validates required prebuild artifacts. |
| scripts/fetch-kernel.mjs | Updates kernel fetch defaults for macOS/arm64 kernel naming. |
| scripts/check-gcov.mjs | Updates KVM gcov paths to the new native file layout. |
| scripts/build-prebuilt-rootfs.mjs | Adds CI-facing tool to build + gzip + manifest prebuilt rootfs release assets. |
| scripts/build-native.mjs | Extends native build to macOS arm64 and adds libslirp detection/staging for Windows builds. |
| package.json | Exposes new subpath exports (./disk, ./prebuilt-rootfs), adds scripts, and adjusts coverage command args. |
| native/whp/win_io.h | Adds Windows file I/O helpers for virtio-blk/overlay operations. |
| native/whp/win_console_ctrl.h | Declares scoped console Ctrl handler helper. |
| native/whp/win_console_ctrl.cc | Implements Ctrl-C/Ctrl-Break forwarding hook lifecycle. |
| native/whp/virtio/rng.h | Adds virtio-rng-mmio device declaration. |
| native/whp/virtio/rng.cc | Implements virtio-rng-mmio device using BCryptGenRandom. |
| native/whp/virtio/desc.h | Adds shared virtio-mmio constants + descriptor types/helpers. |
| native/whp/virtio/blk.h | Refactors/introduces virtio-blk-mmio device interface for WHP. |
| native/whp/page_tables.h | Adds helpers for x86_64 identity-map page tables + segment/table register helpers. |
| native/whp/page_tables.cc | Implements page table and register helper routines. |
| native/whp/irq.h | Adds WHP IRQ delivery state machine declarations + pure decision helper API. |
| native/whp/irq.cc | Implements WHP external interrupt injection + window arming logic. |
| native/whp/guest_memory.h | Adds guest memory view helper with bounds checking. |
| native/whp/elf_loader.h | Declares ELF kernel loader for WHP vmlinux-style kernels. |
| native/whp/elf_loader.cc | Implements ELF64 segment loading into guest memory with range/size checks. |
| native/whp/devices/uart.h | Adds UART device interface with IRQ raiser wiring and CRLF normalization contract. |
| native/whp/devices/pit.h | Adds PIT device declaration for IRQ0 + channel 2 calibration behavior. |
| native/whp/devices/pit.cc | Implements PIT behavior (reload, latching, irq coalescing, channel 2 gating). |
| native/whp/devices/pic.h | Adds minimal PIC (8259A) device declaration used to gate ExtInt injection. |
| native/whp/devices/pic.cc | Implements PIC init/mask handling + fixed interrupt requests. |
| native/whp/devices/hpet.h | Adds HPET device declaration for Linux clocksource/timer usage. |
| native/whp/devices/cmos.h | Adds CMOS/RTC device declaration for stable boot/runtime reads. |
| native/whp/devices/cmos.cc | Implements CMOS/RTC reads with host UTC refresh on access. |
| native/whp/devices/acpi_pm_timer.h | Adds ACPI PM timer device declaration. |
| native/whp/devices/acpi_pm_timer.cc | Implements free-running ACPI PM timer counter reads. |
| native/whp/boot_params.h | Declares Linux x86 boot params + MP table writers. |
| native/whp/boot_params.cc | Implements boot params and MP table construction. |
| native/whp/api.h | Adds header-only dynamic loader for WinHvPlatform/WinHvEmulation entry points. |
| native/common/bytes.h | Adds shared C++ byte helpers, checked arithmetic/range helpers, and Windows error formatting. |
| guest/node-vmm-console.cc | Improves guest console helper (CRLF handling, tty mode, polling/drain behavior, tty sizing). |
| docs/testing.md | Updates test documentation for Windows/WHP and macOS/HVF gates and matrices. |
| docs/sdk.md | Documents expanded SDK surface: Windows prebuilt rootfs behavior, persistence/attach-disk semantics, etc. |
| docs/publishing.md | Updates publishing docs for multi-OS prebuild release workflow and rootfs prebuilts. |
| docs/performance.md | Adds latest WHP performance measurements and sample outputs. |
| docs/cpp-coverage-exclusions.json | Updates excluded native file path to new KVM backend location. |
| binding.gyp | Splits native backend sources per OS, adds HVF sources/flags, and WHP module list + optional libslirp wiring. |
| .gitignore | Ignores new tooling/cache directories. |
| .github/workflows/release-prebuilds.yml | Adds tag-triggered multi-OS prebuild build+release+publish workflow. |
| .github/workflows/prebuilt-rootfs.yml | Adds tag-triggered rootfs prebuild build+release workflow. |
| .github/workflows/ci.yml | Renames/restructures CI jobs and adds self-hosted WHP/KVM gates. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add Linux KVM slirp networking
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation