# amudhan015/myos architecture

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

- Interactive diagram: https://gitdiagram.com/amudhan015/myos
- Repository: https://github.com/amudhan015/myos

## Overview

This repository is a small 32-bit x86 kernel. Its intended user-to-result path is booting the kernel, initializing processor and memory facilities, then handling device input and presenting output. The tree also shows interrupt, timer, task, paging, and allocation subsystems. The README is empty, and sampled source does not include the kernel entry, keyboard, PIC, PIT, task, or GDT implementations, so their wiring is not inferred here; edges show only relationships supported by sampled code.

Main entry points: [`kernel/idt.c`](https://github.com/amudhan015/myos/blob/main/kernel/idt.c) (IDT Setup), [`kernel/pmm.c`](https://github.com/amudhan015/myos/blob/main/kernel/pmm.c) (Frame Allocator), [`kernel/paging.c`](https://github.com/amudhan015/myos/blob/main/kernel/paging.c) (Paging), [`kernel/kmalloc.c`](https://github.com/amudhan015/myos/blob/main/kernel/kmalloc.c) (Kernel Allocator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_boot["Boot and CPU"]
  node_bootasm["Boot Assembly<br/>[boot.s]"]
  node_kernel["Kernel Entry<br/>[kernel.c]"]
  node_gdt["GDT Setup<br/>[gdt.c]"]
  node_gdtasm["GDT Assembly<br/>[gdt_asm.s]"]
end

subgraph group_interrupts["Interrupts and Tasks"]
  node_idt["IDT Setup<br/>[idt.c]"]
  node_idtasm["IDT Assembly<br/>[idt_asm.s]"]
  node_isr["Exception Handler<br/>[isr.c]"]
  node_isr_asm["Exception Stubs<br/>[isr_asm.s]"]
  node_irqasm["IRQ Stubs<br/>[irq_asm.s]"]
  node_irq["IRQ Handling<br/>[irq.c]"]
  node_task["Task Scheduler<br/>[task.c]"]
  node_switchasm["Context Switch<br/>[switch_asm.s]"]
end

subgraph group_memory["Memory Management"]
  node_paging["Paging<br/>[paging.c]"]
  node_pmm["Frame Allocator<br/>[pmm.c]"]
  node_kmalloc["Kernel Allocator<br/>[kmalloc.c]"]
  node_multiboot["Boot Memory Map<br/>[multiboot.h]"]
end

subgraph group_io["Device I/O"]
  node_keyboard["Keyboard Driver<br/>[keyboard.c]"]
  node_terminal["Terminal<br/>[terminal.c]"]
  node_serial["Serial Output<br/>[serial.c]"]
  node_pic["Interrupt Controller<br/>[pic.c]"]
  node_pit["Timer Driver<br/>[pit.c]"]
end

node_bootloader(("Bootloader"))
node_vga[("VGA Text Device")]
node_uart(("Serial Port"))

node_idt -->|"installs exception gates"| node_isr_asm
node_idt -->|"installs IRQ gates"| node_irqasm
node_idt -->|"loads IDT"| node_idtasm
node_pmm -->|"reads memory map"| node_multiboot
node_paging -->|"allocates frames"| node_pmm
node_kmalloc -->|"allocates frames"| node_pmm
node_terminal -->|"renders viewport"| node_vga
node_serial -->|"writes output"| node_uart

click node_bootasm "https://github.com/amudhan015/myos/blob/main/boot/boot.s"
click node_kernel "https://github.com/amudhan015/myos/blob/main/kernel/kernel.c"
click node_gdt "https://github.com/amudhan015/myos/blob/main/kernel/gdt.c"
click node_gdtasm "https://github.com/amudhan015/myos/blob/main/kernel/gdt_asm.s"
click node_paging "https://github.com/amudhan015/myos/blob/main/kernel/paging.c"
click node_pmm "https://github.com/amudhan015/myos/blob/main/kernel/pmm.c"
click node_kmalloc "https://github.com/amudhan015/myos/blob/main/kernel/kmalloc.c"
click node_multiboot "https://github.com/amudhan015/myos/blob/main/include/kernel/multiboot.h"
click node_idt "https://github.com/amudhan015/myos/blob/main/kernel/idt.c"
click node_idtasm "https://github.com/amudhan015/myos/blob/main/kernel/idt_asm.s"
click node_isr "https://github.com/amudhan015/myos/blob/main/kernel/isr.c"
click node_isr_asm "https://github.com/amudhan015/myos/blob/main/kernel/isr_asm.s"
click node_irqasm "https://github.com/amudhan015/myos/blob/main/kernel/irq_asm.s"
click node_irq "https://github.com/amudhan015/myos/blob/main/kernel/irq.c"
click node_task "https://github.com/amudhan015/myos/blob/main/kernel/task.c"
click node_switchasm "https://github.com/amudhan015/myos/blob/main/kernel/switch_asm.s"
click node_keyboard "https://github.com/amudhan015/myos/blob/main/kernel/keyboard.c"
click node_terminal "https://github.com/amudhan015/myos/blob/main/kernel/terminal.c"
click node_serial "https://github.com/amudhan015/myos/blob/main/kernel/serial.c"
click node_pic "https://github.com/amudhan015/myos/blob/main/kernel/pic.c"
click node_pit "https://github.com/amudhan015/myos/blob/main/kernel/pit.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_bootasm,node_kernel,node_gdt,node_gdtasm toneBlue
class node_idt,node_idtasm,node_isr,node_isr_asm,node_irqasm,node_irq,node_task,node_switchasm,node_vga toneAmber
class node_paging,node_pmm,node_kmalloc,node_multiboot toneMint
class node_keyboard,node_terminal,node_serial,node_pic,node_pit toneRose
class node_bootloader,node_uart toneIndigo
```

## Components

### Boot and CPU

- [Boot Assembly](https://github.com/amudhan015/myos/blob/main/boot/boot.s): `boot/boot.s`
- [Kernel Entry](https://github.com/amudhan015/myos/blob/main/kernel/kernel.c): `kernel/kernel.c`
- [GDT Setup](https://github.com/amudhan015/myos/blob/main/kernel/gdt.c): `kernel/gdt.c`
- [GDT Assembly](https://github.com/amudhan015/myos/blob/main/kernel/gdt_asm.s): `kernel/gdt_asm.s`

### Interrupts and Tasks

- [IDT Setup](https://github.com/amudhan015/myos/blob/main/kernel/idt.c): `kernel/idt.c`
- [IDT Assembly](https://github.com/amudhan015/myos/blob/main/kernel/idt_asm.s): `kernel/idt_asm.s`
- [Exception Handler](https://github.com/amudhan015/myos/blob/main/kernel/isr.c): `kernel/isr.c`
- [Exception Stubs](https://github.com/amudhan015/myos/blob/main/kernel/isr_asm.s): `kernel/isr_asm.s`
- [IRQ Stubs](https://github.com/amudhan015/myos/blob/main/kernel/irq_asm.s): `kernel/irq_asm.s`
- [IRQ Handling](https://github.com/amudhan015/myos/blob/main/kernel/irq.c): `kernel/irq.c`
- [Task Scheduler](https://github.com/amudhan015/myos/blob/main/kernel/task.c): `kernel/task.c`
- [Context Switch](https://github.com/amudhan015/myos/blob/main/kernel/switch_asm.s): `kernel/switch_asm.s`

### Memory Management

- [Paging](https://github.com/amudhan015/myos/blob/main/kernel/paging.c): `kernel/paging.c`
- [Frame Allocator](https://github.com/amudhan015/myos/blob/main/kernel/pmm.c): `kernel/pmm.c`
- [Kernel Allocator](https://github.com/amudhan015/myos/blob/main/kernel/kmalloc.c): `kernel/kmalloc.c`
- [Boot Memory Map](https://github.com/amudhan015/myos/blob/main/include/kernel/multiboot.h): `include/kernel/multiboot.h`

### Device I/O

- [Keyboard Driver](https://github.com/amudhan015/myos/blob/main/kernel/keyboard.c): `kernel/keyboard.c`
- [Terminal](https://github.com/amudhan015/myos/blob/main/kernel/terminal.c): `kernel/terminal.c`
- [Serial Output](https://github.com/amudhan015/myos/blob/main/kernel/serial.c): `kernel/serial.c`
- [Interrupt Controller](https://github.com/amudhan015/myos/blob/main/kernel/pic.c): `kernel/pic.c`
- [Timer Driver](https://github.com/amudhan015/myos/blob/main/kernel/pit.c): `kernel/pit.c`

### Other components

- **Bootloader**
- **VGA Text Device**
- **Serial Port**

## Connections

- IDT Setup → Exception Stubs: installs exception gates
- IDT Setup → IRQ Stubs: installs IRQ gates
- IDT Setup → IDT Assembly: loads IDT
- Frame Allocator → Boot Memory Map: reads memory map
- Paging → Frame Allocator: allocates frames
- Kernel Allocator → Frame Allocator: allocates frames
- Terminal → VGA Text Device: renders viewport
- Serial Output → Serial Port: writes output
