# zero-tang/noirvisor architecture

> Architecture diagram of the GitHub repository zero-tang/noirvisor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zero-tang/noirvisor
- Repository: https://github.com/zero-tang/noirvisor

## Overview

NoirVisor is a Type-1 AMD64 hypervisor supporting Intel VT-x/EPT and AMD-V/NPT, with a customizable-VM API. The principal boot workflow is firmware or a Windows kernel driver loading the hypervisor, whose entry point selects the processor-specific virtualization backend and subverts the host. Custom VMs are exposed through a separate API surface. The graph preserves the documented IOMMU, ACPI, and disassembly capabilities; unsampled subsystem relationships are omitted rather than inferred.

Main entry points: [`src/lib.rs`](https://github.com/zero-tang/noirvisor/blob/master/src/lib.rs) (Hypervisor Entry), [`src/vt_core/mod.rs`](https://github.com/zero-tang/noirvisor/blob/master/src/vt_core/mod.rs) (Intel VT-x), [`src/svm_core/mod.rs`](https://github.com/zero-tang/noirvisor/blob/master/src/svm_core/mod.rs) (AMD-V SVM), [`crates/loadefi/src/main.rs`](https://github.com/zero-tang/noirvisor/blob/master/crates/loadefi/src/main.rs) (EFI Loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Boot and Interfaces"]
  node_efi_loader["EFI Loader<br/>[main.rs]"]
  node_efi_runtime["UEFI Runtime Driver<br/>[uefihvm.rs]"]
  node_windows_driver["Windows Driver<br/>[lib.rs]"]
end

subgraph group_hypervisor["Hypervisor Backends"]
  node_core_entry["Hypervisor Entry<br/>[lib.rs]"]
  node_intel_vtx["Intel VT-x<br/>[mod.rs]"]
  node_intel_ept["Intel EPT<br/>[ept.rs]"]
  node_amd_svm["AMD-V SVM<br/>[mod.rs]"]
  node_amd_npt["AMD NPT<br/>[npt.rs]"]
end

subgraph group_cvm["Custom Virtualization"]
  node_cvm_api["CVM API<br/>[c_api.rs]"]
  node_cvm_state["CVM x86 State<br/>[cpuid.rs]"]
  node_disassembler["Instruction Emulator<br/>[emulator.rs]"]
  node_virtual_machine["VM Lifecycle<br/>[mod.rs]"]
end

subgraph group_platform["Platform Services"]
  node_acpi["ACPI Tables<br/>[tables.rs]"]
  node_iommu["IOMMU Drivers<br/>[mod.rs]"]
  node_hypervisor_abi["Hypervisor Calls<br/>[hvcall.rs]"]
end

subgraph group_foundation["Core Framework"]
  node_x86_framework["x86 Framework<br/>[x86.rs]"]
  node_memory["Memory Allocator<br/>[allocator.rs]"]
end

node_firmware(("UEFI Firmware"))
node_windows(("Windows Service"))

node_firmware -->|"boots"| node_efi_loader
node_efi_loader -->|"loads image"| node_efi_runtime
node_windows -->|"starts driver"| node_windows_driver
node_efi_runtime -.->|"invokes core"| node_core_entry
node_windows_driver -.->|"invokes core"| node_core_entry
node_core_entry -->|"selects backend"| node_intel_vtx
node_core_entry -->|"selects backend"| node_amd_svm
node_intel_vtx -.->|"initializes EPT"| node_intel_ept
node_amd_svm -.->|"builds NPT"| node_amd_npt
node_cvm_api -.->|"delegates lifecycle"| node_virtual_machine
node_virtual_machine -.->|"syncs state"| node_cvm_state
node_disassembler -->|"uses definitions"| node_x86_framework
node_iommu -->|"reads tables"| node_acpi
node_intel_vtx -.->|"supports calls"| node_hypervisor_abi
node_amd_svm -.->|"supports calls"| node_hypervisor_abi
node_core_entry -.->|"uses definitions"| node_x86_framework
node_core_entry -->|"uses allocator"| node_memory

click node_efi_loader "https://github.com/zero-tang/noirvisor/blob/master/crates/loadefi/src/main.rs"
click node_efi_runtime "https://github.com/zero-tang/noirvisor/blob/master/src/booting/uefirtdrv/src/uefihvm.rs"
click node_windows_driver "https://github.com/zero-tang/noirvisor/blob/master/crates/windrv/src/lib.rs"
click node_core_entry "https://github.com/zero-tang/noirvisor/blob/master/src/lib.rs"
click node_intel_vtx "https://github.com/zero-tang/noirvisor/blob/master/src/vt_core/mod.rs"
click node_intel_ept "https://github.com/zero-tang/noirvisor/blob/master/src/vt_core/ept.rs"
click node_amd_svm "https://github.com/zero-tang/noirvisor/blob/master/src/svm_core/mod.rs"
click node_amd_npt "https://github.com/zero-tang/noirvisor/blob/master/src/svm_core/npt.rs"
click node_cvm_api "https://github.com/zero-tang/noirvisor/blob/master/crates/nvcvm/src/interface/c_api.rs"
click node_cvm_state "https://github.com/zero-tang/noirvisor/blob/master/src/cvm_core/x86/cpuid.rs"
click node_disassembler "https://github.com/zero-tang/noirvisor/blob/master/src/disasm/emulator.rs"
click node_acpi "https://github.com/zero-tang/noirvisor/blob/master/src/drv_core/acpi/tables.rs"
click node_iommu "https://github.com/zero-tang/noirvisor/blob/master/src/drv_core/iommu/mod.rs"
click node_hypervisor_abi "https://github.com/zero-tang/noirvisor/blob/master/src/mshv_core/hvcall.rs"
click node_x86_framework "https://github.com/zero-tang/noirvisor/blob/master/src/xpf_core/x86.rs"
click node_memory "https://github.com/zero-tang/noirvisor/blob/master/src/xpf_core/allocator.rs"
click node_virtual_machine "https://github.com/zero-tang/noirvisor/blob/master/src/cvm_core/x86/mod.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_efi_loader,node_efi_runtime,node_windows_driver toneBlue
class node_core_entry,node_intel_vtx,node_intel_ept,node_amd_svm,node_amd_npt toneAmber
class node_cvm_api,node_cvm_state,node_disassembler,node_virtual_machine toneMint
class node_acpi,node_iommu,node_hypervisor_abi toneRose
class node_x86_framework,node_memory,node_firmware,node_windows toneIndigo
```

## Components

### Boot and Interfaces

- [EFI Loader](https://github.com/zero-tang/noirvisor/blob/master/crates/loadefi/src/main.rs): `crates/loadefi/src/main.rs`
- [UEFI Runtime Driver](https://github.com/zero-tang/noirvisor/blob/master/src/booting/uefirtdrv/src/uefihvm.rs): `src/booting/uefirtdrv/src/uefihvm.rs`
- [Windows Driver](https://github.com/zero-tang/noirvisor/blob/master/crates/windrv/src/lib.rs): `crates/windrv/src/lib.rs`

### Hypervisor Backends

- [Hypervisor Entry](https://github.com/zero-tang/noirvisor/blob/master/src/lib.rs): `src/lib.rs`
- [Intel VT-x](https://github.com/zero-tang/noirvisor/blob/master/src/vt_core/mod.rs): `src/vt_core/mod.rs`
- [Intel EPT](https://github.com/zero-tang/noirvisor/blob/master/src/vt_core/ept.rs): `src/vt_core/ept.rs`
- [AMD-V SVM](https://github.com/zero-tang/noirvisor/blob/master/src/svm_core/mod.rs): `src/svm_core/mod.rs`
- [AMD NPT](https://github.com/zero-tang/noirvisor/blob/master/src/svm_core/npt.rs): `src/svm_core/npt.rs`

### Custom Virtualization

- [CVM API](https://github.com/zero-tang/noirvisor/blob/master/crates/nvcvm/src/interface/c_api.rs): `crates/nvcvm/src/interface/c_api.rs`
- [CVM x86 State](https://github.com/zero-tang/noirvisor/blob/master/src/cvm_core/x86/cpuid.rs): `src/cvm_core/x86/cpuid.rs`
- [Instruction Emulator](https://github.com/zero-tang/noirvisor/blob/master/src/disasm/emulator.rs): `src/disasm/emulator.rs`
- [VM Lifecycle](https://github.com/zero-tang/noirvisor/blob/master/src/cvm_core/x86/mod.rs): `src/cvm_core/x86/mod.rs`

### Platform Services

- [ACPI Tables](https://github.com/zero-tang/noirvisor/blob/master/src/drv_core/acpi/tables.rs): `src/drv_core/acpi/tables.rs`
- [IOMMU Drivers](https://github.com/zero-tang/noirvisor/blob/master/src/drv_core/iommu/mod.rs): `src/drv_core/iommu/mod.rs`
- [Hypervisor Calls](https://github.com/zero-tang/noirvisor/blob/master/src/mshv_core/hvcall.rs): `src/mshv_core/hvcall.rs`

### Core Framework

- [x86 Framework](https://github.com/zero-tang/noirvisor/blob/master/src/xpf_core/x86.rs): `src/xpf_core/x86.rs`
- [Memory Allocator](https://github.com/zero-tang/noirvisor/blob/master/src/xpf_core/allocator.rs): `src/xpf_core/allocator.rs`

### Other components

- **UEFI Firmware**
- **Windows Service**

## Connections

- UEFI Firmware → EFI Loader: boots (evidence: `README.md`)
- EFI Loader → UEFI Runtime Driver: loads image (evidence: `crates/loadefi/src/main.rs`)
- Windows Service → Windows Driver: starts driver (evidence: `README.md`)
- UEFI Runtime Driver → Hypervisor Entry: invokes core
- Windows Driver → Hypervisor Entry: invokes core
- Hypervisor Entry → Intel VT-x: selects backend (evidence: `src/lib.rs`)
- Hypervisor Entry → AMD-V SVM: selects backend (evidence: `src/lib.rs`)
- Intel VT-x → Intel EPT: initializes EPT (evidence: `src/vt_core/mod.rs`)
- AMD-V SVM → AMD NPT: builds NPT (evidence: `src/svm_core/mod.rs`)
- CVM API → VM Lifecycle: delegates lifecycle
- VM Lifecycle → CVM x86 State: syncs state (evidence: `src/cvm_core/x86/mod.rs`)
- Instruction Emulator → x86 Framework: uses definitions (evidence: `src/disasm/emulator.rs`)
- IOMMU Drivers → ACPI Tables: reads tables (evidence: `src/drv_core/iommu/mod.rs`)
- Intel VT-x → Hypervisor Calls: supports calls
- AMD-V SVM → Hypervisor Calls: supports calls
- Hypervisor Entry → x86 Framework: uses definitions
- Hypervisor Entry → Memory Allocator: uses allocator (evidence: `src/lib.rs`)
