# george17c/kvm-vmm architecture

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

- Interactive diagram: https://gitdiagram.com/george17c/kvm-vmm
- Repository: https://github.com/george17c/kvm-vmm

## Overview

This is an early-stage educational Linux KVM virtual machine monitor. Its workflow parses a memory-size option and checks a supplied file path, creates a VM and guest RAM, creates and configures an x86_64 vCPU, copies in hardcoded test instructions, runs until HLT, handles simple serial output, and cleans up. The supplied file is not parsed or loaded as a kernel. The graph reflects the shown runtime calls and README capabilities; the test-bytecode implementation is unsampled, so its connection is documented rather than source-verified.

Main entry points: [`src/vmm.c`](https://github.com/george17c/kvm-vmm/blob/main/src/vmm.c) (CLI and lifecycle), [`src/kvm.c`](https://github.com/george17c/kvm-vmm/blob/main/src/kvm.c) (KVM VM lifecycle), [`src/arch/x86_64/vcpu.c`](https://github.com/george17c/kvm-vmm/blob/main/src/arch/x86_64/vcpu.c) (x86 vCPU), [`src/mem.c`](https://github.com/george17c/kvm-vmm/blob/main/src/mem.c) (Guest RAM mapping)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["VMM control"]
  node_vmm["CLI and lifecycle<br/>[vmm.c]"]
  node_api["VM declarations"]
end

subgraph group_kvm["KVM and memory"]
  node_kvm_lifecycle["KVM VM lifecycle<br/>[kvm.c]"]
  node_guest_memory["Guest RAM mapping<br/>[mem.c]"]
end

subgraph group_x86["x86 execution"]
  node_x86_vcpu["x86 vCPU<br/>[vcpu.c]"]
  node_test_code["Test instructions<br/>[test.c]"]
end

node_user(("Operator"))
node_linux_kvm["Linux KVM"]
node_terminal(("Terminal output"))

node_user -->|"runs"| node_vmm
node_vmm -->|"creates VM"| node_kvm_lifecycle
node_kvm_lifecycle -->|"opens and configures"| node_linux_kvm
node_kvm_lifecycle -->|"sets RAM"| node_guest_memory
node_guest_memory -->|"registers RAM"| node_linux_kvm
node_vmm -->|"creates and runs"| node_x86_vcpu
node_x86_vcpu -->|"configures and runs"| node_linux_kvm
node_vmm -.->|"copies instructions"| node_test_code
node_x86_vcpu -->|"prints serial output"| node_terminal
node_vmm -->|"destroys VM"| node_kvm_lifecycle

click node_vmm "https://github.com/george17c/kvm-vmm/blob/main/src/vmm.c"
click node_api "https://github.com/george17c/kvm-vmm/tree/main/include"
click node_kvm_lifecycle "https://github.com/george17c/kvm-vmm/blob/main/src/kvm.c"
click node_guest_memory "https://github.com/george17c/kvm-vmm/blob/main/src/mem.c"
click node_x86_vcpu "https://github.com/george17c/kvm-vmm/blob/main/src/arch/x86_64/vcpu.c"
click node_test_code "https://github.com/george17c/kvm-vmm/blob/main/src/arch/x86_64/test.c"

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_vmm,node_api toneBlue
class node_kvm_lifecycle,node_guest_memory toneAmber
class node_x86_vcpu,node_test_code toneMint
class node_user,node_linux_kvm,node_terminal toneIndigo
```

## Components

### VMM control

- [CLI and lifecycle](https://github.com/george17c/kvm-vmm/blob/main/src/vmm.c): `src/vmm.c`
- [VM declarations](https://github.com/george17c/kvm-vmm/tree/main/include): `include`

### KVM and memory

- [KVM VM lifecycle](https://github.com/george17c/kvm-vmm/blob/main/src/kvm.c): `src/kvm.c`
- [Guest RAM mapping](https://github.com/george17c/kvm-vmm/blob/main/src/mem.c): `src/mem.c`

### x86 execution

- [x86 vCPU](https://github.com/george17c/kvm-vmm/blob/main/src/arch/x86_64/vcpu.c): `src/arch/x86_64/vcpu.c`
- [Test instructions](https://github.com/george17c/kvm-vmm/blob/main/src/arch/x86_64/test.c): `src/arch/x86_64/test.c`

### Other components

- **Operator**
- **Linux KVM**
- **Terminal output**

## Connections

- Operator → CLI and lifecycle: runs (evidence: `README.md`)
- CLI and lifecycle → KVM VM lifecycle: creates VM (evidence: `src/vmm.c`)
- KVM VM lifecycle → Linux KVM: opens and configures (evidence: `src/kvm.c`)
- KVM VM lifecycle → Guest RAM mapping: sets RAM (evidence: `src/kvm.c`)
- Guest RAM mapping → Linux KVM: registers RAM (evidence: `src/mem.c`)
- CLI and lifecycle → x86 vCPU: creates and runs (evidence: `src/vmm.c`)
- x86 vCPU → Linux KVM: configures and runs (evidence: `src/arch/x86_64/vcpu.c`)
- CLI and lifecycle → Test instructions: copies instructions (evidence: `README.md`)
- x86 vCPU → Terminal output: prints serial output (evidence: `src/arch/x86_64/vcpu.c`)
- CLI and lifecycle → KVM VM lifecycle: destroys VM (evidence: `src/vmm.c`)
