# friedrichosdev/nanoos architecture

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

- Interactive diagram: https://gitdiagram.com/friedrichosdev/nanoos
- Repository: https://github.com/friedrichosdev/nanoos

## Overview

NanoOS is an experimental x86_64 hobby operating system. Its principal workflow begins with Multiboot2 boot information, initializes kernel CPU and memory facilities, discovers platform hardware, and starts scheduling across available CPUs. Separate branches provide input and graphical output. The README documents the boot sequence and capabilities; source excerpts confirm selected implementation links, but many listed subsystems were not sampled, so their internal connections are not inferred.

Main entry points: [`src/kernel/core/init.c`](https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/core/init.c) (Kernel Initialization), [`src/kernel/arch/x86_64/apic/apic.c`](https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/arch/x86_64/apic/apic.c) (APIC and Timers), [`src/kernel/arch/x86_64/smp/smp.c`](https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/arch/x86_64/smp/smp.c) (SMP Startup), [`src/kernel/arch/x86_64/acpi/acpi.c`](https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/arch/x86_64/acpi/acpi.c) (ACPI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_boot["Boot and Core"]
  node_multiboot["Multiboot2<br/>[multiboot2.c]"]
  node_kernel_init["Kernel Initialization<br/>[init.c]"]
  node_gdt["GDT<br/>[gdt.c]"]
  node_interrupts["Interrupt Handling<br/>[handler.c]"]
end

subgraph group_memory["Memory Management"]
  node_pmm["Physical Memory<br/>[pmm.c]"]
  node_vmm["Virtual Memory<br/>[vmm.c]"]
  node_heap["Kernel Heap<br/>[heap.c]"]
end

subgraph group_platform["Platform Hardware"]
  node_acpi["ACPI<br/>[acpi.c]"]
  node_apic["APIC and Timers<br/>[apic.c]"]
  node_pci["PCI Enumeration<br/>[pci.c]"]
  node_rtc["RTC<br/>[rtc.c]"]
  node_serial["Serial Driver<br/>[serial.c]"]
end

subgraph group_multitasking["Multitasking"]
  node_scheduler["Scheduler<br/>[sched.c]"]
  node_threads["Threads and Processes<br/>[thread.c]"]
  node_smp["SMP Startup<br/>[smp.c]"]
end

subgraph group_devices["Input and Graphics"]
  node_ps2["PS/2 Controller<br/>[i8042.c]"]
  node_input["Input Events<br/>[input.c]"]
  node_hid["HID Interface<br/>[hid.c]"]
  node_framebuffer["Framebuffer Driver<br/>[fb_driver.c]"]
  node_gfx["Graphics Abstraction<br/>[gfx.c]"]
  node_compositor["2D Compositor<br/>[compositor.c]"]
  node_splash["Version Splash<br/>[version_splash.c]"]
end

subgraph group_runtime["Kernel Runtime"]
  node_math["Math Library<br/>[__rem_pio2_large.c]"]
end

node_firmware(("UEFI / GRUB"))

node_firmware -->|"loads kernel"| node_multiboot
node_multiboot -->|"passes boot data"| node_kernel_init
node_kernel_init -->|"initializes CPU"| node_gdt
node_kernel_init -->|"initializes interrupts"| node_interrupts
node_kernel_init -->|"initializes memory"| node_pmm
node_kernel_init -->|"initializes memory"| node_vmm
node_vmm -->|"allocates pages"| node_pmm
node_kernel_init -->|"initializes platform"| node_acpi
node_kernel_init -->|"initializes platform"| node_apic
node_kernel_init -->|"initializes platform"| node_pci
node_apic -->|"reads tables"| node_acpi
node_pci -->|"reads tables"| node_acpi
node_kernel_init -->|"starts scheduling"| node_scheduler
node_kernel_init -->|"starts SMP"| node_smp
node_smp -->|"starts CPUs"| node_apic
node_smp -->|"loads descriptors"| node_gdt
node_interrupts -->|"acknowledges IRQ"| node_apic
node_kernel_init -->|"initializes input"| node_ps2
node_ps2 -.->|"delivers events"| node_input
node_input -.->|"provides events"| node_hid
node_kernel_init -->|"initializes graphics"| node_framebuffer
node_framebuffer -.->|"provides video"| node_gfx
node_gfx -.->|"renders layers"| node_compositor
node_compositor -.->|"renders splash"| node_splash

click node_multiboot "https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/arch/x86_64/boot/multiboot2.c"
click node_kernel_init "https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/core/init.c"
click node_gdt "https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/arch/x86_64/gdt/gdt.c"
click node_interrupts "https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/arch/x86_64/idt/handler.c"
click node_pmm "https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/arch/x86_64/mm/pmm.c"
click node_vmm "https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/arch/x86_64/mm/vmm.c"
click node_heap "https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/arch/x86_64/mm/heap.c"
click node_acpi "https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/arch/x86_64/acpi/acpi.c"
click node_apic "https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/arch/x86_64/apic/apic.c"
click node_pci "https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/arch/x86_64/drivers/pci.c"
click node_rtc "https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/arch/x86_64/drivers/rtc.c"
click node_serial "https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/arch/x86_64/drivers/serial.c"
click node_scheduler "https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/sched/sched.c"
click node_threads "https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/sched/thread.c"
click node_smp "https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/arch/x86_64/smp/smp.c"
click node_ps2 "https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/drivers/hid/ps2/i8042.c"
click node_input "https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/drivers/hid/input.c"
click node_hid "https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/drivers/hid/hid.c"
click node_framebuffer "https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/drivers/gfx/framebuffer/fb_driver.c"
click node_gfx "https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/drivers/gfx/gfx.c"
click node_compositor "https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/drivers/gfx/compositor/compositor.c"
click node_splash "https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/drivers/gfx/version_splash/version_splash.c"
click node_math "https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/lib/math/__rem_pio2_large.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_multiboot,node_kernel_init,node_gdt,node_interrupts toneBlue
class node_pmm,node_vmm,node_heap toneAmber
class node_acpi,node_apic,node_pci,node_rtc,node_serial toneMint
class node_scheduler,node_threads,node_smp toneRose
class node_ps2,node_input,node_hid,node_framebuffer,node_gfx,node_compositor,node_splash,node_firmware toneIndigo
class node_math toneTeal
```

## Components

### Boot and Core

- [Multiboot2](https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/arch/x86_64/boot/multiboot2.c): `src/kernel/arch/x86_64/boot/multiboot2.c`
- [Kernel Initialization](https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/core/init.c): `src/kernel/core/init.c`
- [GDT](https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/arch/x86_64/gdt/gdt.c): `src/kernel/arch/x86_64/gdt/gdt.c`
- [Interrupt Handling](https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/arch/x86_64/idt/handler.c): `src/kernel/arch/x86_64/idt/handler.c`

### Memory Management

- [Physical Memory](https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/arch/x86_64/mm/pmm.c): `src/kernel/arch/x86_64/mm/pmm.c`
- [Virtual Memory](https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/arch/x86_64/mm/vmm.c): `src/kernel/arch/x86_64/mm/vmm.c`
- [Kernel Heap](https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/arch/x86_64/mm/heap.c): `src/kernel/arch/x86_64/mm/heap.c`

### Platform Hardware

- [ACPI](https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/arch/x86_64/acpi/acpi.c): `src/kernel/arch/x86_64/acpi/acpi.c`
- [APIC and Timers](https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/arch/x86_64/apic/apic.c): `src/kernel/arch/x86_64/apic/apic.c`
- [PCI Enumeration](https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/arch/x86_64/drivers/pci.c): `src/kernel/arch/x86_64/drivers/pci.c`
- [RTC](https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/arch/x86_64/drivers/rtc.c): `src/kernel/arch/x86_64/drivers/rtc.c`
- [Serial Driver](https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/arch/x86_64/drivers/serial.c): `src/kernel/arch/x86_64/drivers/serial.c`

### Multitasking

- [Scheduler](https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/sched/sched.c): `src/kernel/sched/sched.c`
- [Threads and Processes](https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/sched/thread.c): `src/kernel/sched/thread.c`
- [SMP Startup](https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/arch/x86_64/smp/smp.c): `src/kernel/arch/x86_64/smp/smp.c`

### Input and Graphics

- [PS/2 Controller](https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/drivers/hid/ps2/i8042.c): `src/kernel/drivers/hid/ps2/i8042.c`
- [Input Events](https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/drivers/hid/input.c): `src/kernel/drivers/hid/input.c`
- [HID Interface](https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/drivers/hid/hid.c): `src/kernel/drivers/hid/hid.c`
- [Framebuffer Driver](https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/drivers/gfx/framebuffer/fb_driver.c): `src/kernel/drivers/gfx/framebuffer/fb_driver.c`
- [Graphics Abstraction](https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/drivers/gfx/gfx.c): `src/kernel/drivers/gfx/gfx.c`
- [2D Compositor](https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/drivers/gfx/compositor/compositor.c): `src/kernel/drivers/gfx/compositor/compositor.c`
- [Version Splash](https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/drivers/gfx/version_splash/version_splash.c): `src/kernel/drivers/gfx/version_splash/version_splash.c`

### Kernel Runtime

- [Math Library](https://github.com/friedrichosdev/nanoos/blob/x86_64-main/src/kernel/lib/math/__rem_pio2_large.c): `src/kernel/lib/math/__rem_pio2_large.c`

### Other components

- **UEFI / GRUB**

## Connections

- UEFI / GRUB → Multiboot2: loads kernel (evidence: `README.md`)
- Multiboot2 → Kernel Initialization: passes boot data (evidence: `README.md`)
- Kernel Initialization → GDT: initializes CPU (evidence: `README.md`)
- Kernel Initialization → Interrupt Handling: initializes interrupts (evidence: `README.md`)
- Kernel Initialization → Physical Memory: initializes memory (evidence: `README.md`)
- Kernel Initialization → Virtual Memory: initializes memory (evidence: `README.md`)
- Virtual Memory → Physical Memory: allocates pages (evidence: `src/kernel/arch/x86_64/mm/vmm.c`)
- Kernel Initialization → ACPI: initializes platform (evidence: `README.md`)
- Kernel Initialization → APIC and Timers: initializes platform (evidence: `README.md`)
- Kernel Initialization → PCI Enumeration: initializes platform (evidence: `README.md`)
- APIC and Timers → ACPI: reads tables (evidence: `src/kernel/arch/x86_64/apic/apic.c`)
- PCI Enumeration → ACPI: reads tables (evidence: `src/kernel/arch/x86_64/drivers/pci.c`)
- Kernel Initialization → Scheduler: starts scheduling (evidence: `README.md`)
- Kernel Initialization → SMP Startup: starts SMP (evidence: `README.md`)
- SMP Startup → APIC and Timers: starts CPUs (evidence: `src/kernel/arch/x86_64/smp/smp.c`)
- SMP Startup → GDT: loads descriptors (evidence: `src/kernel/arch/x86_64/smp/smp.c`)
- Interrupt Handling → APIC and Timers: acknowledges IRQ (evidence: `src/kernel/arch/x86_64/idt/handler.c`)
- Kernel Initialization → PS/2 Controller: initializes input (evidence: `README.md`)
- PS/2 Controller → Input Events: delivers events
- Input Events → HID Interface: provides events
- Kernel Initialization → Framebuffer Driver: initializes graphics (evidence: `README.md`)
- Framebuffer Driver → Graphics Abstraction: provides video
- Graphics Abstraction → 2D Compositor: renders layers
- 2D Compositor → Version Splash: renders splash
