Skip to content

About

A lightweight hypervisor for Nintendo Switch.

Topics

Resources

Stars

8 stars

Watchers

0 watching

Forks

Repository files navigation

switchvisor

A lightweight hypervisor for Nintendo Switch.

Switchvisor occupies the platform's BL33 slot and supports two boot modes. The default hypervisor mode keeps Switchvisor at EL2 and starts one guest at EL1. Loader mode starts the raw payload directly at EL2 and releases its boot memory.

The current platform integration boots through Hekate L4T and a compatible BL31. Early boot messages use Hekate's framebuffer.

Hekate -> BL31 -> Switchvisor (EL2) -> guest entry (EL1) or native payload (EL2)

Build environment

flake.nix provides the Rust toolchain and development tools. From the repository root, enter the Nix development shell:

nix develop

Run the following build and development commands inside this shell.

Quick start

Prepare a raw AArch64 payload and a Hekate L4T bootstack directory containing bl31.bin, bl33.bin, and nx-plat.dtimg that match the pinned bootstack configuration. Then build:

scripts/build-payload.sh path/to/payload.raw 0x100000 path/to/bootstack

0x100000 is the payload's full runtime size, including BSS. To run the bootstack's own U-Boot as the guest, pass path/to/bootstack/bl33.bin with runtime size 0x68200.

Copy dist/bl33.bin to the microSD path configured for BL33 by the selected Hekate L4T boot entry. The entry boots hypervisor mode by default; set switchvisor_mode=loader in the entry to start the payload natively at EL2.

Documentation

Topic Contents
Building a payload Output files, boot mode selection, U-Boot memory requirements, entry and register options, repackaging
USB console --usb-uart: guest console over USB CDC ACM and its DT overlay
USB control and bundle loading --usb-control: switchvisorctl, multi-image bundles, the automatic RCM payload cycle
USB network --usb-net: CDC-NCM bridged to a guest virtio-net device
Guest entry contract CPU state, memory layout, PSCI, GIC, and the VMM reservation
Guest hypercalls HVC ABI, diagnostics log, MMIO tracing
Scarlet guest control Scarlet driver and swvctl CLI

Development

cargo test --workspace
cargo check-el2
cargo build-hv

License

Switchvisor is licensed under the GNU General Public License version 2 only. See LICENSE. See THIRD_PARTY.md for Hekate attribution.

About

A lightweight hypervisor for Nintendo Switch.

Topics

Resources

Stars

8 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages