# fathurwithyou/32bit-kernel-oshi_no_ko architecture

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

- Interactive diagram: https://gitdiagram.com/fathurwithyou/32bit-kernel-oshi_no_ko
- Repository: https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko

## Overview

OShi-no-Ko is a small x86 operating system. Its documented execution path boots the kernel, initializes CPU and device facilities, loads the shell from EXT2, creates a user process, and starts scheduling; user requests enter through interrupts and syscalls. The graph also preserves the filesystem, graphics, keyboard, clock, and external file-insertion capabilities evidenced by the tree and source index. Relationship evidence is limited to the excerpts, indexed references, and README; unsampled wiring is omitted rather than inferred.

Main entry points: [`src/kernel.c`](https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/kernel.c) (Kernel setup), [`src/cpu/interrupt.c`](https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/cpu/interrupt.c) (Interrupt handling), [`src/filesystem/ext2.c`](https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/filesystem/ext2.c) (EXT2 filesystem), [`src/scheduler/scheduler.c`](https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/scheduler/scheduler.c) (Scheduler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_boot["Kernel and CPU"]
  node_kernel["Kernel setup<br/>[kernel.c]"]
  node_gdt["GDT and TSS<br/>[gdt.c]"]
  node_idt["Interrupt tables<br/>[idt.c]"]
  node_interrupt["Interrupt handling<br/>[interrupt.c]"]
  node_portio["Port I/O<br/>[portio.c]"]
end

subgraph group_runtime["Processes and I/O"]
  node_paging["Virtual memory<br/>[paging.c]"]
  node_process["Process manager<br/>[process.c]"]
  node_scheduler["Scheduler<br/>[scheduler.c]"]
  node_context["Context switching<br/>[context-switch.s]"]
  node_keyboard["Keyboard input<br/>[keyboard.c]"]
  node_scancode["Scancode mapping<br/>[scancode.c]"]
  node_string["String utilities<br/>[string.c]"]
end

subgraph group_media["Storage and display"]
  node_disk["ATA disk driver<br/>[disk.c]"]
  node_ext2["EXT2 filesystem<br/>[ext2.c]"]
  node_graphics["Graphics display<br/>[graphics.c]"]
  node_framebuffer["Text framebuffer<br/>[framebuffer.c]"]
  node_cmos["Clock hardware<br/>[cmos.c]"]
end

subgraph group_user["User programs"]
  node_shell["User shell<br/>[user-shell.c]"]
  node_clockapp["Clock program<br/>[clock.c]"]
  node_inserter["File inserter"]
end

node_actor(("System operator"))

node_actor -->|"runs system"| node_kernel
node_kernel -->|"loads descriptors"| node_gdt
node_kernel -->|"initializes tables"| node_idt
node_kernel -->|"enables interrupts"| node_interrupt
node_kernel -->|"initializes display"| node_graphics
node_kernel -->|"initializes filesystem"| node_ext2
node_kernel -->|"allocates kernel page"| node_paging
node_kernel -->|"creates shell process"| node_process
node_kernel -->|"starts scheduling"| node_scheduler
node_interrupt -->|"dispatches input"| node_keyboard
node_interrupt -->|"dispatches syscalls"| node_ext2
node_interrupt -->|"dispatches display calls"| node_graphics
node_interrupt -->|"handles process exit"| node_process
node_interrupt -->|"handles timer"| node_scheduler
node_keyboard -->|"uses mappings"| node_scancode
node_process -->|"manages address spaces"| node_paging
node_scheduler -->|"selects process"| node_process
node_scheduler -.->|"switches context"| node_context
node_ext2 -.->|"reads and writes blocks"| node_disk
node_graphics -->|"programs display ports"| node_portio
node_framebuffer -->|"controls cursor"| node_portio
node_cmos -->|"reads clock ports"| node_portio
node_kernel -->|"loads executable"| node_shell
node_shell -.->|"requests file operations"| node_ext2
node_clockapp -->|"reads clock"| node_cmos
node_inserter -.->|"inserts files"| node_ext2
node_kernel -->|"uses memory helpers"| node_string

click node_kernel "https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/kernel.c"
click node_gdt "https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/cpu/gdt.c"
click node_idt "https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/cpu/idt.c"
click node_interrupt "https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/cpu/interrupt.c"
click node_portio "https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/cpu/portio.c"
click node_paging "https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/paging/paging.c"
click node_process "https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/process/process.c"
click node_scheduler "https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/scheduler/scheduler.c"
click node_context "https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/scheduler/context-switch.s"
click node_keyboard "https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/keyboard.c"
click node_scancode "https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/scancode.c"
click node_disk "https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/driver/disk.c"
click node_ext2 "https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/filesystem/ext2.c"
click node_graphics "https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/graphics/graphics.c"
click node_framebuffer "https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/text/framebuffer.c"
click node_cmos "https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/cmos/cmos.c"
click node_shell "https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/external/user-shell.c"
click node_clockapp "https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/external/clock.c"
click node_inserter "https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/external/external-inserter.c"
click node_string "https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/stdlib/string.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_kernel,node_gdt,node_idt,node_interrupt,node_portio toneBlue
class node_paging,node_process,node_scheduler,node_context,node_keyboard,node_scancode,node_string toneAmber
class node_disk,node_ext2,node_graphics,node_framebuffer,node_cmos toneMint
class node_shell,node_clockapp,node_inserter toneRose
class node_actor toneIndigo
```

## Components

### Kernel and CPU

- [Kernel setup](https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/kernel.c): `src/kernel.c`
- [GDT and TSS](https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/cpu/gdt.c): `src/cpu/gdt.c`
- [Interrupt tables](https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/cpu/idt.c): `src/cpu/idt.c`
- [Interrupt handling](https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/cpu/interrupt.c): `src/cpu/interrupt.c`
- [Port I/O](https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/cpu/portio.c): `src/cpu/portio.c`

### Processes and I/O

- [Virtual memory](https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/paging/paging.c): `src/paging/paging.c`
- [Process manager](https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/process/process.c): `src/process/process.c`
- [Scheduler](https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/scheduler/scheduler.c): `src/scheduler/scheduler.c`
- [Context switching](https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/scheduler/context-switch.s): `src/scheduler/context-switch.s`
- [Keyboard input](https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/keyboard.c): `src/keyboard.c`
- [Scancode mapping](https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/scancode.c): `src/scancode.c`
- [String utilities](https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/stdlib/string.c): `src/stdlib/string.c`

### Storage and display

- [ATA disk driver](https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/driver/disk.c): `src/driver/disk.c`
- [EXT2 filesystem](https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/filesystem/ext2.c): `src/filesystem/ext2.c`
- [Graphics display](https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/graphics/graphics.c): `src/graphics/graphics.c`
- [Text framebuffer](https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/text/framebuffer.c): `src/text/framebuffer.c`
- [Clock hardware](https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/cmos/cmos.c): `src/cmos/cmos.c`

### User programs

- [User shell](https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/external/user-shell.c): `src/external/user-shell.c`
- [Clock program](https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/external/clock.c): `src/external/clock.c`
- [File inserter](https://github.com/fathurwithyou/32bit-kernel-oshi_no_ko/blob/main/src/external/external-inserter.c): `src/external/external-inserter.c`

### Other components

- **System operator**

## Connections

- System operator → Kernel setup: runs system (evidence: `README.md`)
- Kernel setup → GDT and TSS: loads descriptors (evidence: `src/kernel.c`)
- Kernel setup → Interrupt tables: initializes tables (evidence: `src/kernel.c`)
- Kernel setup → Interrupt handling: enables interrupts (evidence: `src/kernel.c`)
- Kernel setup → Graphics display: initializes display (evidence: `src/kernel.c`)
- Kernel setup → EXT2 filesystem: initializes filesystem (evidence: `src/kernel.c`)
- Kernel setup → Virtual memory: allocates kernel page (evidence: `src/kernel.c`)
- Kernel setup → Process manager: creates shell process (evidence: `src/kernel.c`)
- Kernel setup → Scheduler: starts scheduling (evidence: `src/kernel.c`)
- Interrupt handling → Keyboard input: dispatches input (evidence: `src/cpu/interrupt.c`)
- Interrupt handling → EXT2 filesystem: dispatches syscalls (evidence: `src/cpu/interrupt.c`)
- Interrupt handling → Graphics display: dispatches display calls (evidence: `src/cpu/interrupt.c`)
- Interrupt handling → Process manager: handles process exit (evidence: `src/cpu/interrupt.c`)
- Interrupt handling → Scheduler: handles timer (evidence: `src/cpu/interrupt.c`)
- Keyboard input → Scancode mapping: uses mappings (evidence: `src/keyboard.c`)
- Process manager → Virtual memory: manages address spaces (evidence: `src/process/process.c`)
- Scheduler → Process manager: selects process (evidence: `src/scheduler/scheduler.c`)
- Scheduler → Context switching: switches context
- EXT2 filesystem → ATA disk driver: reads and writes blocks
- Graphics display → Port I/O: programs display ports (evidence: `src/graphics/graphics.c`)
- Text framebuffer → Port I/O: controls cursor (evidence: `src/text/framebuffer.c`)
- Clock hardware → Port I/O: reads clock ports (evidence: `src/cmos/cmos.c`)
- Kernel setup → User shell: loads executable (evidence: `src/kernel.c`)
- User shell → EXT2 filesystem: requests file operations
- Clock program → Clock hardware: reads clock (evidence: `src/external/clock.c`)
- File inserter → EXT2 filesystem: inserts files
- Kernel setup → String utilities: uses memory helpers (evidence: `src/kernel.c`)
