# orangethewell/tupiny architecture

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

- Interactive diagram: https://gitdiagram.com/orangethewell/tupiny
- Repository: https://github.com/orangethewell/tupiny

## Overview

Aurora OS is a small x86_64 experimental kernel. Its boot entry initializes memory and heap, interrupt infrastructure, display/TTY, and IDE detection, then starts async example and keyboard tasks under the executor. Other implemented capabilities include ELF-backed thread setup and timer-driven scheduling, syscall support, PCI scanning, and FAT access through IDE. The graph follows only relationships visible in excerpts or the source index; syscall and IDE filesystem internals are included where supported, but their runtime wiring is not assumed.

Main entry points: [`kernel/src/main.rs`](https://github.com/orangethewell/tupiny/blob/master/kernel/src/main.rs) (Kernel entry), [`kernel/src/interrupts.rs`](https://github.com/orangethewell/tupiny/blob/master/kernel/src/interrupts.rs) (Interrupt and APIC), [`kernel/src/process.rs`](https://github.com/orangethewell/tupiny/blob/master/kernel/src/process.rs) (Thread scheduling), [`kernel/src/memory.rs`](https://github.com/orangethewell/tupiny/blob/master/kernel/src/memory.rs) (Memory mapping)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_boot["Kernel startup"]
  node_boot["Kernel entry<br/>[main.rs]"]
end

subgraph group_core["Platform core"]
  node_memory["Memory mapping<br/>[memory.rs]"]
  node_allocator["Heap allocator<br/>[allocator.rs]"]
  node_gdt["GDT and TSS<br/>[gdt.rs]"]
  node_interrupts["Interrupt and APIC<br/>[interrupts.rs]"]
  node_syscall["Syscall handling<br/>[syscall.rs]"]
end

subgraph group_ui["Display and input"]
  node_framebuffer["Framebuffer display<br/>[framebuffer.rs]"]
  node_tty["TTY console<br/>[tty.rs]"]
  node_keyboard["Keyboard stream<br/>[keyboard.rs]"]
end

subgraph group_runtime["Tasks and processes"]
  node_executor["Async executor<br/>[executor.rs]"]
  node_simple_executor["Simple executor<br/>[simple_executor.rs]"]
  node_task["Task abstraction<br/>[mod.rs]"]
  node_process["Thread scheduling<br/>[process.rs]"]
end

subgraph group_io["Device and storage"]
  node_ide["IDE and FAT access<br/>[ide.rs]"]
  node_serial["Serial console<br/>[serial.rs]"]
end

node_hardware(("x86 hardware"))
node_bootinfo["Bootloader info"]
node_disk[("IDE disk")]

node_boot -->|"initializes"| node_memory
node_boot -->|"initializes"| node_allocator
node_boot -->|"initializes"| node_interrupts
node_boot -->|"creates display"| node_framebuffer
node_boot -->|"activates"| node_tty
node_boot -->|"detects devices"| node_ide
node_boot -->|"runs"| node_executor
node_boot -->|"spawns task"| node_keyboard
node_boot -->|"creates task"| node_task
node_boot -.->|"initializes"| node_gdt
node_boot -->|"logs through"| node_serial
node_bootinfo -->|"provides boot data"| node_boot
node_memory -.->|"maps pages"| node_hardware
node_allocator -.->|"allocates from frames"| node_memory
node_framebuffer -.->|"writes pixels"| node_hardware
node_tty -->|"draws to"| node_framebuffer
node_interrupts -->|"uses stack indices"| node_gdt
node_interrupts -->|"schedules on timer"| node_process
node_interrupts -->|"queues scancodes"| node_keyboard
node_interrupts -.->|"configures APIC"| node_hardware
node_executor -->|"polls"| node_task
node_simple_executor -->|"polls"| node_task
node_executor -.->|"halts when idle"| node_hardware
node_keyboard -.->|"prints keypresses"| node_tty
node_process -->|"maps ELF segments"| node_memory
node_process -->|"sets thread stack"| node_gdt
node_process -.->|"switches contexts"| node_hardware
node_syscall -.->|"handles system calls"| node_hardware
node_ide -.->|"reads and writes sectors"| node_disk
node_ide -.->|"probes IDE ports"| node_hardware

click node_boot "https://github.com/orangethewell/tupiny/blob/master/kernel/src/main.rs"
click node_memory "https://github.com/orangethewell/tupiny/blob/master/kernel/src/memory.rs"
click node_allocator "https://github.com/orangethewell/tupiny/blob/master/kernel/src/allocator.rs"
click node_gdt "https://github.com/orangethewell/tupiny/blob/master/kernel/src/gdt.rs"
click node_interrupts "https://github.com/orangethewell/tupiny/blob/master/kernel/src/interrupts.rs"
click node_syscall "https://github.com/orangethewell/tupiny/blob/master/kernel/src/syscall.rs"
click node_framebuffer "https://github.com/orangethewell/tupiny/blob/master/kernel/src/framebuffer.rs"
click node_tty "https://github.com/orangethewell/tupiny/blob/master/kernel/src/tty.rs"
click node_keyboard "https://github.com/orangethewell/tupiny/blob/master/kernel/src/task/keyboard.rs"
click node_executor "https://github.com/orangethewell/tupiny/blob/master/kernel/src/task/executor.rs"
click node_simple_executor "https://github.com/orangethewell/tupiny/blob/master/kernel/src/task/simple_executor.rs"
click node_task "https://github.com/orangethewell/tupiny/blob/master/kernel/src/task/mod.rs"
click node_process "https://github.com/orangethewell/tupiny/blob/master/kernel/src/process.rs"
click node_ide "https://github.com/orangethewell/tupiny/blob/master/kernel/src/ide.rs"
click node_serial "https://github.com/orangethewell/tupiny/blob/master/kernel/src/serial.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_boot toneBlue
class node_memory,node_allocator,node_gdt,node_interrupts,node_syscall,node_disk toneAmber
class node_framebuffer,node_tty,node_keyboard toneMint
class node_executor,node_simple_executor,node_task,node_process toneRose
class node_ide,node_serial,node_hardware,node_bootinfo toneIndigo
```

## Components

### Kernel startup

- [Kernel entry](https://github.com/orangethewell/tupiny/blob/master/kernel/src/main.rs): `kernel/src/main.rs`

### Platform core

- [Memory mapping](https://github.com/orangethewell/tupiny/blob/master/kernel/src/memory.rs): `kernel/src/memory.rs`
- [Heap allocator](https://github.com/orangethewell/tupiny/blob/master/kernel/src/allocator.rs): `kernel/src/allocator.rs`
- [GDT and TSS](https://github.com/orangethewell/tupiny/blob/master/kernel/src/gdt.rs): `kernel/src/gdt.rs`
- [Interrupt and APIC](https://github.com/orangethewell/tupiny/blob/master/kernel/src/interrupts.rs): `kernel/src/interrupts.rs`
- [Syscall handling](https://github.com/orangethewell/tupiny/blob/master/kernel/src/syscall.rs): `kernel/src/syscall.rs`

### Display and input

- [Framebuffer display](https://github.com/orangethewell/tupiny/blob/master/kernel/src/framebuffer.rs): `kernel/src/framebuffer.rs`
- [TTY console](https://github.com/orangethewell/tupiny/blob/master/kernel/src/tty.rs): `kernel/src/tty.rs`
- [Keyboard stream](https://github.com/orangethewell/tupiny/blob/master/kernel/src/task/keyboard.rs): `kernel/src/task/keyboard.rs`

### Tasks and processes

- [Async executor](https://github.com/orangethewell/tupiny/blob/master/kernel/src/task/executor.rs): `kernel/src/task/executor.rs`
- [Simple executor](https://github.com/orangethewell/tupiny/blob/master/kernel/src/task/simple_executor.rs): `kernel/src/task/simple_executor.rs`
- [Task abstraction](https://github.com/orangethewell/tupiny/blob/master/kernel/src/task/mod.rs): `kernel/src/task/mod.rs`
- [Thread scheduling](https://github.com/orangethewell/tupiny/blob/master/kernel/src/process.rs): `kernel/src/process.rs`

### Device and storage

- [IDE and FAT access](https://github.com/orangethewell/tupiny/blob/master/kernel/src/ide.rs): `kernel/src/ide.rs`
- [Serial console](https://github.com/orangethewell/tupiny/blob/master/kernel/src/serial.rs): `kernel/src/serial.rs`

### Other components

- **x86 hardware**
- **Bootloader info**
- **IDE disk**

## Connections

- Kernel entry → Memory mapping: initializes (evidence: `kernel/src/main.rs`)
- Kernel entry → Heap allocator: initializes (evidence: `kernel/src/main.rs`)
- Kernel entry → Interrupt and APIC: initializes (evidence: `kernel/src/main.rs`)
- Kernel entry → Framebuffer display: creates display (evidence: `kernel/src/main.rs`)
- Kernel entry → TTY console: activates (evidence: `kernel/src/main.rs`)
- Kernel entry → IDE and FAT access: detects devices (evidence: `kernel/src/main.rs`)
- Kernel entry → Async executor: runs (evidence: `kernel/src/main.rs`)
- Kernel entry → Keyboard stream: spawns task (evidence: `kernel/src/main.rs`)
- Kernel entry → Task abstraction: creates task (evidence: `kernel/src/main.rs`)
- Kernel entry → GDT and TSS: initializes (evidence: `kernel/src/main.rs`)
- Kernel entry → Serial console: logs through (evidence: `kernel/src/main.rs`)
- Bootloader info → Kernel entry: provides boot data (evidence: `kernel/src/main.rs`)
- Memory mapping → x86 hardware: maps pages
- Heap allocator → Memory mapping: allocates from frames
- Framebuffer display → x86 hardware: writes pixels
- TTY console → Framebuffer display: draws to (evidence: `kernel/src/tty.rs`)
- Interrupt and APIC → GDT and TSS: uses stack indices (evidence: `kernel/src/interrupts.rs`)
- Interrupt and APIC → Thread scheduling: schedules on timer (evidence: `kernel/src/interrupts.rs`)
- Interrupt and APIC → Keyboard stream: queues scancodes (evidence: `kernel/src/interrupts.rs`)
- Interrupt and APIC → x86 hardware: configures APIC
- Async executor → Task abstraction: polls (evidence: `kernel/src/task/executor.rs`)
- Simple executor → Task abstraction: polls (evidence: `kernel/src/task/simple_executor.rs`)
- Async executor → x86 hardware: halts when idle
- Keyboard stream → TTY console: prints keypresses
- Thread scheduling → Memory mapping: maps ELF segments (evidence: `kernel/src/process.rs`)
- Thread scheduling → GDT and TSS: sets thread stack (evidence: `kernel/src/process.rs`)
- Thread scheduling → x86 hardware: switches contexts
- Syscall handling → x86 hardware: handles system calls
- IDE and FAT access → IDE disk: reads and writes sectors
- IDE and FAT access → x86 hardware: probes IDE ports
