# jj0o0/miyara architecture

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

- Interactive diagram: https://gitdiagram.com/jj0o0/miyara
- Repository: https://github.com/jj0o0/miyara

## Overview

This is a WIP x86 kernel, with PS/2 keyboard and mouse input, event delivery, shell interaction, graphics/text output, interrupts, timers, and memory management represented in the tree. The visible input path decodes device data into events; the shell handles key events and writes through a graphic terminal. Several links are explicit in excerpts, but boot initialization and the routing from queued events to shell input are not shown, so they are omitted. The README documents no additional capabilities beyond its WIP status.

Main entry points: [`kernel/keyboard/keyboard.c`](https://github.com/jj0o0/miyara/blob/main/kernel/keyboard/keyboard.c) (Keyboard), [`kernel/mouse/mouse.c`](https://github.com/jj0o0/miyara/blob/main/kernel/mouse/mouse.c) (Mouse), [`kernel/shell/shell.c`](https://github.com/jj0o0/miyara/blob/main/kernel/shell/shell.c) (Shell), [`kernel/graphics/graphic_terminal.c`](https://github.com/jj0o0/miyara/blob/main/kernel/graphics/graphic_terminal.c) (Graphic Terminal)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["Input and Events"]
  node_ps2["PS/2 Controller<br/>[ps2.c]"]
  node_keyboard["Keyboard<br/>[keyboard.c]"]
  node_mouse["Mouse<br/>[mouse.c]"]
  node_events["Event Queue<br/>[event.c]"]
  node_keymap["Key Translation<br/>[keymap.c]"]
end

subgraph group_display["Display"]
  node_graphic_terminal["Graphic Terminal<br/>[graphic_terminal.c]"]
  node_renderer["Renderer<br/>[renderer.c]"]
  node_framebuffer["Framebuffer<br/>[framebuffer.c]"]
  node_text_terminal["Text Terminal<br/>[terminal.c]"]
end

subgraph group_memory["Memory Management"]
  node_paging["Virtual Memory<br/>[paging.c]"]
  node_physical_memory["Physical Memory<br/>[pmm.c]"]
  node_heap["Heap<br/>[heap.c]"]
  node_memory_init["Memory Setup<br/>[memory.c]"]
end

subgraph group_kernel["Kernel Services"]
  node_shell["Shell<br/>[shell.c]"]
  node_interrupts["Interrupt Tables<br/>[idt.c]"]
  node_irq["IRQ Dispatch<br/>[irq.c]"]
  node_timer["Timer<br/>[timer.c]"]
  node_pit["PIT<br/>[pit.c]"]
  node_logger["Logging<br/>[log.c]"]
end

node_keyboard -->|"reads and configures"| node_ps2
node_keyboard -->|"queues key events"| node_events
node_mouse -->|"reads and configures"| node_ps2
node_mouse -->|"queues mouse events"| node_events
node_shell -->|"translates keys"| node_keymap
node_shell -->|"writes and edits"| node_graphic_terminal
node_graphic_terminal -->|"draws through"| node_renderer
node_paging -->|"allocates pages"| node_physical_memory

click node_ps2 "https://github.com/jj0o0/miyara/blob/main/kernel/io/ps2.c"
click node_keyboard "https://github.com/jj0o0/miyara/blob/main/kernel/keyboard/keyboard.c"
click node_mouse "https://github.com/jj0o0/miyara/blob/main/kernel/mouse/mouse.c"
click node_events "https://github.com/jj0o0/miyara/blob/main/kernel/event/event.c"
click node_keymap "https://github.com/jj0o0/miyara/blob/main/kernel/keyboard/keymap.c"
click node_shell "https://github.com/jj0o0/miyara/blob/main/kernel/shell/shell.c"
click node_graphic_terminal "https://github.com/jj0o0/miyara/blob/main/kernel/graphics/graphic_terminal.c"
click node_renderer "https://github.com/jj0o0/miyara/blob/main/kernel/graphics/renderer.c"
click node_framebuffer "https://github.com/jj0o0/miyara/blob/main/kernel/graphics/framebuffer.c"
click node_text_terminal "https://github.com/jj0o0/miyara/blob/main/kernel/terminal/terminal.c"
click node_paging "https://github.com/jj0o0/miyara/blob/main/kernel/memory/paging.c"
click node_physical_memory "https://github.com/jj0o0/miyara/blob/main/kernel/memory/pmm.c"
click node_heap "https://github.com/jj0o0/miyara/blob/main/kernel/memory/heap.c"
click node_memory_init "https://github.com/jj0o0/miyara/blob/main/kernel/memory/memory.c"
click node_interrupts "https://github.com/jj0o0/miyara/blob/main/kernel/interrupt/idt/idt.c"
click node_irq "https://github.com/jj0o0/miyara/blob/main/kernel/interrupt/irq/irq.c"
click node_timer "https://github.com/jj0o0/miyara/blob/main/kernel/timer/timer.c"
click node_pit "https://github.com/jj0o0/miyara/blob/main/kernel/timer/pit.c"
click node_logger "https://github.com/jj0o0/miyara/blob/main/kernel/log/log.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_ps2,node_keyboard,node_mouse,node_events,node_keymap toneBlue
class node_graphic_terminal,node_renderer,node_framebuffer,node_text_terminal toneAmber
class node_paging,node_physical_memory,node_heap,node_memory_init toneMint
class node_shell,node_interrupts,node_irq,node_timer,node_pit,node_logger toneRose
```

## Components

### Input and Events

- [PS/2 Controller](https://github.com/jj0o0/miyara/blob/main/kernel/io/ps2.c): `kernel/io/ps2.c`
- [Keyboard](https://github.com/jj0o0/miyara/blob/main/kernel/keyboard/keyboard.c): `kernel/keyboard/keyboard.c`
- [Mouse](https://github.com/jj0o0/miyara/blob/main/kernel/mouse/mouse.c): `kernel/mouse/mouse.c`
- [Event Queue](https://github.com/jj0o0/miyara/blob/main/kernel/event/event.c): `kernel/event/event.c`
- [Key Translation](https://github.com/jj0o0/miyara/blob/main/kernel/keyboard/keymap.c): `kernel/keyboard/keymap.c`

### Display

- [Graphic Terminal](https://github.com/jj0o0/miyara/blob/main/kernel/graphics/graphic_terminal.c): `kernel/graphics/graphic_terminal.c`
- [Renderer](https://github.com/jj0o0/miyara/blob/main/kernel/graphics/renderer.c): `kernel/graphics/renderer.c`
- [Framebuffer](https://github.com/jj0o0/miyara/blob/main/kernel/graphics/framebuffer.c): `kernel/graphics/framebuffer.c`
- [Text Terminal](https://github.com/jj0o0/miyara/blob/main/kernel/terminal/terminal.c): `kernel/terminal/terminal.c`

### Memory Management

- [Virtual Memory](https://github.com/jj0o0/miyara/blob/main/kernel/memory/paging.c): `kernel/memory/paging.c`
- [Physical Memory](https://github.com/jj0o0/miyara/blob/main/kernel/memory/pmm.c): `kernel/memory/pmm.c`
- [Heap](https://github.com/jj0o0/miyara/blob/main/kernel/memory/heap.c): `kernel/memory/heap.c`
- [Memory Setup](https://github.com/jj0o0/miyara/blob/main/kernel/memory/memory.c): `kernel/memory/memory.c`

### Kernel Services

- [Shell](https://github.com/jj0o0/miyara/blob/main/kernel/shell/shell.c): `kernel/shell/shell.c`
- [Interrupt Tables](https://github.com/jj0o0/miyara/blob/main/kernel/interrupt/idt/idt.c): `kernel/interrupt/idt/idt.c`
- [IRQ Dispatch](https://github.com/jj0o0/miyara/blob/main/kernel/interrupt/irq/irq.c): `kernel/interrupt/irq/irq.c`
- [Timer](https://github.com/jj0o0/miyara/blob/main/kernel/timer/timer.c): `kernel/timer/timer.c`
- [PIT](https://github.com/jj0o0/miyara/blob/main/kernel/timer/pit.c): `kernel/timer/pit.c`
- [Logging](https://github.com/jj0o0/miyara/blob/main/kernel/log/log.c): `kernel/log/log.c`

## Connections

- Keyboard → PS/2 Controller: reads and configures (evidence: `kernel/keyboard/keyboard.c`)
- Keyboard → Event Queue: queues key events (evidence: `kernel/keyboard/keyboard.c`)
- Mouse → PS/2 Controller: reads and configures (evidence: `kernel/mouse/mouse.c`)
- Mouse → Event Queue: queues mouse events (evidence: `kernel/mouse/mouse.c`)
- Shell → Key Translation: translates keys (evidence: `kernel/shell/shell.c`)
- Shell → Graphic Terminal: writes and edits (evidence: `kernel/shell/shell.c`)
- Graphic Terminal → Renderer: draws through (evidence: `kernel/graphics/graphic_terminal.c`)
- Virtual Memory → Physical Memory: allocates pages (evidence: `kernel/memory/paging.c`)
