# batatafisher/projectos architecture

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

- Interactive diagram: https://gitdiagram.com/batatafisher/projectos
- Repository: https://github.com/batatafisher/projectos

## Overview

ProjectOS is a small 32-bit kernel with an interactive terminal shell, filesystem commands, ext2 storage, and memory and hardware support. The user workflow is keyboard input → shell command dispatch → command-specific work, such as filesystem operations, with output through the terminal. The graph also preserves interrupt, memory, driver, and C-library subsystems visible in the tree. Evidence is limited to the supplied excerpts and source index; many links between unsampled kernel modules are therefore omitted.

Main entry points: [`kernel/shell/shell.c`](https://github.com/batatafisher/projectos/blob/main/kernel/shell/shell.c) (Shell), [`kernel/shell/commands`](https://github.com/batatafisher/projectos/tree/main/kernel/shell/commands) (Shell Commands), [`kernel/arch/i386/vga_text.c`](https://github.com/batatafisher/projectos/blob/main/kernel/arch/i386/vga_text.c) (Text Terminal), [`kernel/input/keyboard.c`](https://github.com/batatafisher/projectos/blob/main/kernel/input/keyboard.c) (Keyboard Input)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["User Interaction"]
  node_keyboard["Keyboard Input<br/>[keyboard.c]"]
  node_shell["Shell<br/>[shell.c]"]
  node_shell_commands["Shell Commands"]
  node_terminal["Text Terminal<br/>[vga_text.c]"]
  node_vga_format["VGA Text Format<br/>[vga.h]"]
end

subgraph group_storage["Filesystem and Storage"]
  node_vfs["Virtual Filesystem<br/>[vfs.c]"]
  node_ext2["ext2 Filesystem<br/>[ext2.c]"]
  node_ata["ATA PIO Driver<br/>[ata.c]"]
  node_driver_init["Driver Initialization<br/>[init_drivers.c]"]
end

subgraph group_platform["Kernel Platform"]
  node_kernel_entry["Kernel Entry<br/>[kernel.c]"]
  node_interrupts["Interrupt Handling<br/>[interrupts.c]"]
  node_faults["Fault Handling<br/>[faults_handler.c]"]
  node_pic["8259 PIC<br/>[8259_pic.c]"]
  node_gdt["Global Descriptor Table<br/>[gdt.c]"]
  node_idt["Interrupt Descriptor Table<br/>[idt.c]"]
  node_pmm["Physical Memory<br/>[pmm.c]"]
  node_mmu["Memory Management<br/>[mmu.c]"]
  node_vmm["Virtual Memory<br/>[vmm.c]"]
  node_panic["Kernel Panic<br/>[panic.c]"]
end

subgraph group_runtime["C Runtime"]
  node_libc_stdio["Formatted I/O<br/>[vprintf.c]"]
  node_libc_string["String Utilities<br/>[split_with.c]"]
end

node_user(("User"))

node_user -.->|"types on"| node_keyboard
node_keyboard -->|"provides input"| node_shell
node_shell -->|"dispatches commands"| node_shell_commands
node_shell -->|"echoes input"| node_terminal
node_terminal -->|"formats cells"| node_vga_format
node_shell_commands -->|"uses filesystem"| node_vfs
node_shell_commands -->|"checks paths"| node_vfs
node_ext2 -->|"reads blocks"| node_ata
node_shell -->|"splits commands"| node_libc_string
node_shell -->|"prints output"| node_libc_stdio
node_faults -->|"clears screen"| node_terminal

click node_keyboard "https://github.com/batatafisher/projectos/blob/main/kernel/input/keyboard.c"
click node_shell "https://github.com/batatafisher/projectos/blob/main/kernel/shell/shell.c"
click node_shell_commands "https://github.com/batatafisher/projectos/tree/main/kernel/shell/commands"
click node_terminal "https://github.com/batatafisher/projectos/blob/main/kernel/arch/i386/vga_text.c"
click node_vga_format "https://github.com/batatafisher/projectos/blob/main/kernel/arch/i386/vga.h"
click node_vfs "https://github.com/batatafisher/projectos/blob/main/kernel/filesystem/vfs.c"
click node_ext2 "https://github.com/batatafisher/projectos/blob/main/kernel/filesystem/ext2.c"
click node_ata "https://github.com/batatafisher/projectos/blob/main/kernel/drivers/ata.c"
click node_driver_init "https://github.com/batatafisher/projectos/blob/main/kernel/drivers/init_drivers.c"
click node_kernel_entry "https://github.com/batatafisher/projectos/blob/main/kernel/kernel/kernel.c"
click node_interrupts "https://github.com/batatafisher/projectos/blob/main/kernel/arch/i386/interrupts.c"
click node_faults "https://github.com/batatafisher/projectos/blob/main/kernel/arch/i386/faults_handler.c"
click node_pic "https://github.com/batatafisher/projectos/blob/main/kernel/arch/i386/8259_pic.c"
click node_gdt "https://github.com/batatafisher/projectos/blob/main/kernel/arch/i386/gdt.c"
click node_idt "https://github.com/batatafisher/projectos/blob/main/kernel/arch/i386/idt.c"
click node_pmm "https://github.com/batatafisher/projectos/blob/main/kernel/memory/pmm.c"
click node_mmu "https://github.com/batatafisher/projectos/blob/main/kernel/memory/mmu.c"
click node_vmm "https://github.com/batatafisher/projectos/blob/main/kernel/memory/vmm.c"
click node_panic "https://github.com/batatafisher/projectos/blob/main/kernel/kernel/panic.c"
click node_libc_stdio "https://github.com/batatafisher/projectos/blob/main/libc/stdio/vprintf.c"
click node_libc_string "https://github.com/batatafisher/projectos/blob/main/libc/string/split_with.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_keyboard,node_shell,node_shell_commands,node_terminal,node_vga_format,node_user toneBlue
class node_vfs,node_ext2,node_ata,node_driver_init toneAmber
class node_kernel_entry,node_interrupts,node_faults,node_pic,node_gdt,node_idt,node_pmm,node_mmu,node_vmm,node_panic toneMint
class node_libc_stdio,node_libc_string toneRose
```

## Components

### User Interaction

- [Keyboard Input](https://github.com/batatafisher/projectos/blob/main/kernel/input/keyboard.c): `kernel/input/keyboard.c`
- [Shell](https://github.com/batatafisher/projectos/blob/main/kernel/shell/shell.c): `kernel/shell/shell.c`
- [Shell Commands](https://github.com/batatafisher/projectos/tree/main/kernel/shell/commands): `kernel/shell/commands`
- [Text Terminal](https://github.com/batatafisher/projectos/blob/main/kernel/arch/i386/vga_text.c): `kernel/arch/i386/vga_text.c`
- [VGA Text Format](https://github.com/batatafisher/projectos/blob/main/kernel/arch/i386/vga.h): `kernel/arch/i386/vga.h`

### Filesystem and Storage

- [Virtual Filesystem](https://github.com/batatafisher/projectos/blob/main/kernel/filesystem/vfs.c): `kernel/filesystem/vfs.c`
- [ext2 Filesystem](https://github.com/batatafisher/projectos/blob/main/kernel/filesystem/ext2.c): `kernel/filesystem/ext2.c`
- [ATA PIO Driver](https://github.com/batatafisher/projectos/blob/main/kernel/drivers/ata.c): `kernel/drivers/ata.c`
- [Driver Initialization](https://github.com/batatafisher/projectos/blob/main/kernel/drivers/init_drivers.c): `kernel/drivers/init_drivers.c`

### Kernel Platform

- [Kernel Entry](https://github.com/batatafisher/projectos/blob/main/kernel/kernel/kernel.c): `kernel/kernel/kernel.c`
- [Interrupt Handling](https://github.com/batatafisher/projectos/blob/main/kernel/arch/i386/interrupts.c): `kernel/arch/i386/interrupts.c`
- [Fault Handling](https://github.com/batatafisher/projectos/blob/main/kernel/arch/i386/faults_handler.c): `kernel/arch/i386/faults_handler.c`
- [8259 PIC](https://github.com/batatafisher/projectos/blob/main/kernel/arch/i386/8259_pic.c): `kernel/arch/i386/8259_pic.c`
- [Global Descriptor Table](https://github.com/batatafisher/projectos/blob/main/kernel/arch/i386/gdt.c): `kernel/arch/i386/gdt.c`
- [Interrupt Descriptor Table](https://github.com/batatafisher/projectos/blob/main/kernel/arch/i386/idt.c): `kernel/arch/i386/idt.c`
- [Physical Memory](https://github.com/batatafisher/projectos/blob/main/kernel/memory/pmm.c): `kernel/memory/pmm.c`
- [Memory Management](https://github.com/batatafisher/projectos/blob/main/kernel/memory/mmu.c): `kernel/memory/mmu.c`
- [Virtual Memory](https://github.com/batatafisher/projectos/blob/main/kernel/memory/vmm.c): `kernel/memory/vmm.c`
- [Kernel Panic](https://github.com/batatafisher/projectos/blob/main/kernel/kernel/panic.c): `kernel/kernel/panic.c`

### C Runtime

- [Formatted I/O](https://github.com/batatafisher/projectos/blob/main/libc/stdio/vprintf.c): `libc/stdio/vprintf.c`
- [String Utilities](https://github.com/batatafisher/projectos/blob/main/libc/string/split_with.c): `libc/string/split_with.c`

### Other components

- **User**

## Connections

- User → Keyboard Input: types on
- Keyboard Input → Shell: provides input (evidence: `kernel/shell/shell.c`)
- Shell → Shell Commands: dispatches commands (evidence: `kernel/shell/shell.c`)
- Shell → Text Terminal: echoes input (evidence: `kernel/shell/shell.c`)
- Text Terminal → VGA Text Format: formats cells (evidence: `kernel/arch/i386/vga_text.c`)
- Shell Commands → Virtual Filesystem: uses filesystem (evidence: `kernel/shell/commands/filesystem/put.c`)
- Shell Commands → Virtual Filesystem: checks paths (evidence: `kernel/shell/commands/filesystem/cd.c`)
- ext2 Filesystem → ATA PIO Driver: reads blocks (evidence: `kernel/filesystem/ext2.c`)
- Shell → String Utilities: splits commands (evidence: `kernel/shell/shell.c`)
- Shell → Formatted I/O: prints output (evidence: `kernel/shell/shell.c`)
- Fault Handling → Text Terminal: clears screen (evidence: `kernel/arch/i386/faults_handler.c`)
