# 1jehuang/rust-kernel architecture

> Architecture diagram of the GitHub repository 1jehuang/rust-kernel, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/1jehuang/rust-kernel
- Repository: https://github.com/1jehuang/rust-kernel

## Overview

rust-kernel is a bare-metal x86_64 framekernel intended to run isolated workloads directly on cloud servers. The principal workflow is platform boot and handoff, hardware and memory initialization, then Linux-compatible executable loading and syscall handling over process, filesystem, scheduling, and networking services. Snapshot/CAS storage and resource control are additional product capabilities. Edges are limited to relationships visible in excerpts or explicit README statements; where implementation wiring was not shown, relationships are omitted or marked unverified.

Main entry points: [`crates/kernel/src/linux_abi.rs`](https://github.com/1jehuang/rust-kernel/blob/main/crates/kernel/src/linux_abi.rs) (Linux syscall ABI), [`crates/kernel/src/control_plane.rs`](https://github.com/1jehuang/rust-kernel/blob/main/crates/kernel/src/control_plane.rs) (Control plane), [`crates/kernel/src/vfs.rs`](https://github.com/1jehuang/rust-kernel/blob/main/crates/kernel/src/vfs.rs) (CoW filesystem), [`crates/hal/src/boot.rs`](https://github.com/1jehuang/rust-kernel/blob/main/crates/hal/src/boot.rs) (Boot handoff)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_boot["Boot and platform"]
  node_bios["BIOS boot<br/>[main.rs]"]
  node_uefi["UEFI boot<br/>[uefi.rs]"]
end

subgraph group_hal["Hardware abstraction"]
  node_handoff["Boot handoff<br/>[boot.rs]"]
  node_frame_allocator["Frame allocator<br/>[mm.rs]"]
  node_paging["Address spaces<br/>[paging.rs]"]
  node_usercopy["User memory access<br/>[uaccess.rs]"]
  node_trap["Trap and syscall entry<br/>[trap.rs]"]
  node_mitigations["Switch mitigations<br/>[mitigation.rs]"]
  node_net_devices["NIC drivers<br/>[e1000.rs]"]
  node_ena["AWS ENA driver<br/>[ena.rs]"]
  node_nvme["NVMe driver<br/>[nvme.rs]"]
end

subgraph group_execution["Workload execution"]
  node_linux_abi["Linux syscall ABI<br/>[linux_abi.rs]"]
  node_elf["ELF loader<br/>[elf.rs]"]
  node_processes["Process table<br/>[proc.rs]"]
  node_scheduler["Tenant scheduler<br/>[sched.rs]"]
  node_threads["Thread and futex<br/>[thread.rs]"]
end

subgraph group_services["Sandbox services"]
  node_vfs["CoW filesystem<br/>[vfs.rs]"]
  node_cas[("Shared CAS cache<br/>[cas.rs]")]
  node_snapshots["Snapshot state<br/>[snapshot.rs]"]
  node_control["Control plane<br/>[control_plane.rs]"]
  node_netstack["TCP/IP stack<br/>[smol_net.rs]"]
end

node_workload(("User workload"))

node_bios -.->|"hands off"| node_handoff
node_uefi -.->|"hands off"| node_handoff
node_handoff -->|"provides memory map"| node_frame_allocator
node_workload -.->|"issues syscalls"| node_linux_abi
node_linux_abi -->|"copies user data"| node_usercopy
node_linux_abi -->|"reads files"| node_vfs
node_elf -->|"reads executable"| node_vfs
node_linux_abi -->|"maps memory"| node_paging
node_paging -->|"allocates frames"| node_frame_allocator
node_trap -->|"dispatches syscalls"| node_linux_abi
node_linux_abi -.->|"manages processes"| node_processes
node_processes -->|"tracks tenants"| node_scheduler
node_threads -.->|"coordinates threads"| node_scheduler
node_vfs -->|"shares content"| node_cas
node_control -->|"controls processes"| node_processes
node_control -->|"controls tenants"| node_scheduler
node_control -->|"manages filesystems"| node_vfs
node_control -->|"loads programs"| node_elf
node_control -->|"launches ABI"| node_linux_abi
node_netstack -->|"uses Ethernet"| node_net_devices
node_netstack -->|"receives frames"| node_ena
node_vfs -.->|"branches state"| node_snapshots
node_nvme -->|"persists blocks"| node_cas
node_trap -.->|"applies barriers"| node_mitigations

click node_bios "https://github.com/1jehuang/rust-kernel/blob/main/crates/boot-bios/src/main.rs"
click node_uefi "https://github.com/1jehuang/rust-kernel/blob/main/crates/boot-uefi/src/uefi.rs"
click node_handoff "https://github.com/1jehuang/rust-kernel/blob/main/crates/hal/src/boot.rs"
click node_frame_allocator "https://github.com/1jehuang/rust-kernel/blob/main/crates/hal/src/mm.rs"
click node_paging "https://github.com/1jehuang/rust-kernel/blob/main/crates/hal/src/paging.rs"
click node_usercopy "https://github.com/1jehuang/rust-kernel/blob/main/crates/hal/src/uaccess.rs"
click node_trap "https://github.com/1jehuang/rust-kernel/blob/main/crates/hal/src/trap.rs"
click node_mitigations "https://github.com/1jehuang/rust-kernel/blob/main/crates/hal/src/mitigation.rs"
click node_linux_abi "https://github.com/1jehuang/rust-kernel/blob/main/crates/kernel/src/linux_abi.rs"
click node_elf "https://github.com/1jehuang/rust-kernel/blob/main/crates/kernel/src/elf.rs"
click node_processes "https://github.com/1jehuang/rust-kernel/blob/main/crates/kernel/src/proc.rs"
click node_scheduler "https://github.com/1jehuang/rust-kernel/blob/main/crates/kernel/src/sched.rs"
click node_threads "https://github.com/1jehuang/rust-kernel/blob/main/crates/kernel/src/thread.rs"
click node_vfs "https://github.com/1jehuang/rust-kernel/blob/main/crates/kernel/src/vfs.rs"
click node_cas "https://github.com/1jehuang/rust-kernel/blob/main/crates/kernel/src/cas.rs"
click node_snapshots "https://github.com/1jehuang/rust-kernel/blob/main/crates/kernel/src/snapshot.rs"
click node_control "https://github.com/1jehuang/rust-kernel/blob/main/crates/kernel/src/control_plane.rs"
click node_netstack "https://github.com/1jehuang/rust-kernel/blob/main/crates/kernel/src/smol_net.rs"
click node_net_devices "https://github.com/1jehuang/rust-kernel/blob/main/crates/hal/src/e1000.rs"
click node_ena "https://github.com/1jehuang/rust-kernel/blob/main/crates/hal/src/ena.rs"
click node_nvme "https://github.com/1jehuang/rust-kernel/blob/main/crates/hal/src/nvme.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_bios,node_uefi,node_workload toneBlue
class node_handoff,node_frame_allocator,node_paging,node_usercopy,node_trap,node_mitigations,node_net_devices,node_ena,node_nvme toneAmber
class node_linux_abi,node_elf,node_processes,node_scheduler,node_threads toneMint
class node_vfs,node_cas,node_snapshots,node_control,node_netstack toneRose
```

## Components

### Boot and platform

- [BIOS boot](https://github.com/1jehuang/rust-kernel/blob/main/crates/boot-bios/src/main.rs): `crates/boot-bios/src/main.rs`
- [UEFI boot](https://github.com/1jehuang/rust-kernel/blob/main/crates/boot-uefi/src/uefi.rs): `crates/boot-uefi/src/uefi.rs`

### Hardware abstraction

- [Boot handoff](https://github.com/1jehuang/rust-kernel/blob/main/crates/hal/src/boot.rs): `crates/hal/src/boot.rs`
- [Frame allocator](https://github.com/1jehuang/rust-kernel/blob/main/crates/hal/src/mm.rs): `crates/hal/src/mm.rs`
- [Address spaces](https://github.com/1jehuang/rust-kernel/blob/main/crates/hal/src/paging.rs): `crates/hal/src/paging.rs`
- [User memory access](https://github.com/1jehuang/rust-kernel/blob/main/crates/hal/src/uaccess.rs): `crates/hal/src/uaccess.rs`
- [Trap and syscall entry](https://github.com/1jehuang/rust-kernel/blob/main/crates/hal/src/trap.rs): `crates/hal/src/trap.rs`
- [Switch mitigations](https://github.com/1jehuang/rust-kernel/blob/main/crates/hal/src/mitigation.rs): `crates/hal/src/mitigation.rs`
- [NIC drivers](https://github.com/1jehuang/rust-kernel/blob/main/crates/hal/src/e1000.rs): `crates/hal/src/e1000.rs`
- [AWS ENA driver](https://github.com/1jehuang/rust-kernel/blob/main/crates/hal/src/ena.rs): `crates/hal/src/ena.rs`
- [NVMe driver](https://github.com/1jehuang/rust-kernel/blob/main/crates/hal/src/nvme.rs): `crates/hal/src/nvme.rs`

### Workload execution

- [Linux syscall ABI](https://github.com/1jehuang/rust-kernel/blob/main/crates/kernel/src/linux_abi.rs): `crates/kernel/src/linux_abi.rs`
- [ELF loader](https://github.com/1jehuang/rust-kernel/blob/main/crates/kernel/src/elf.rs): `crates/kernel/src/elf.rs`
- [Process table](https://github.com/1jehuang/rust-kernel/blob/main/crates/kernel/src/proc.rs): `crates/kernel/src/proc.rs`
- [Tenant scheduler](https://github.com/1jehuang/rust-kernel/blob/main/crates/kernel/src/sched.rs): `crates/kernel/src/sched.rs`
- [Thread and futex](https://github.com/1jehuang/rust-kernel/blob/main/crates/kernel/src/thread.rs): `crates/kernel/src/thread.rs`

### Sandbox services

- [CoW filesystem](https://github.com/1jehuang/rust-kernel/blob/main/crates/kernel/src/vfs.rs): `crates/kernel/src/vfs.rs`
- [Shared CAS cache](https://github.com/1jehuang/rust-kernel/blob/main/crates/kernel/src/cas.rs): `crates/kernel/src/cas.rs`
- [Snapshot state](https://github.com/1jehuang/rust-kernel/blob/main/crates/kernel/src/snapshot.rs): `crates/kernel/src/snapshot.rs`
- [Control plane](https://github.com/1jehuang/rust-kernel/blob/main/crates/kernel/src/control_plane.rs): `crates/kernel/src/control_plane.rs`
- [TCP/IP stack](https://github.com/1jehuang/rust-kernel/blob/main/crates/kernel/src/smol_net.rs): `crates/kernel/src/smol_net.rs`

### Other components

- **User workload**

## Connections

- BIOS boot → Boot handoff: hands off
- UEFI boot → Boot handoff: hands off
- Boot handoff → Frame allocator: provides memory map (evidence: `crates/hal/src/mm.rs`)
- User workload → Linux syscall ABI: issues syscalls
- Linux syscall ABI → User memory access: copies user data (evidence: `crates/kernel/src/linux_abi.rs`)
- Linux syscall ABI → CoW filesystem: reads files (evidence: `crates/kernel/src/linux_abi.rs`)
- ELF loader → CoW filesystem: reads executable (evidence: `crates/kernel/src/elf.rs`)
- Linux syscall ABI → Address spaces: maps memory (evidence: `crates/kernel/src/linux_abi.rs`)
- Address spaces → Frame allocator: allocates frames (evidence: `crates/hal/src/paging.rs`)
- Trap and syscall entry → Linux syscall ABI: dispatches syscalls (evidence: `crates/hal/src/trap.rs`)
- Linux syscall ABI → Process table: manages processes
- Process table → Tenant scheduler: tracks tenants (evidence: `crates/kernel/src/proc.rs`)
- Thread and futex → Tenant scheduler: coordinates threads
- CoW filesystem → Shared CAS cache: shares content (evidence: `crates/kernel/src/vfs.rs`)
- Control plane → Process table: controls processes (evidence: `crates/kernel/src/control_plane.rs`)
- Control plane → Tenant scheduler: controls tenants (evidence: `crates/kernel/src/control_plane.rs`)
- Control plane → CoW filesystem: manages filesystems (evidence: `crates/kernel/src/control_plane.rs`)
- Control plane → ELF loader: loads programs (evidence: `crates/kernel/src/control_plane.rs`)
- Control plane → Linux syscall ABI: launches ABI (evidence: `crates/kernel/src/control_plane.rs`)
- TCP/IP stack → NIC drivers: uses Ethernet (evidence: `crates/kernel/src/smol_net.rs`)
- TCP/IP stack → AWS ENA driver: receives frames (evidence: `crates/kernel/src/smol_net.rs`)
- CoW filesystem → Snapshot state: branches state
- NVMe driver → Shared CAS cache: persists blocks
- Trap and syscall entry → Switch mitigations: applies barriers
