# itaiaviad/bios architecture

> Architecture diagram of the GitHub repository itaiaviad/bios, 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/itaiaviad/bios
- Repository: https://github.com/itaiaviad/bios

## Overview

BIOS is an educational x86_64 operating system. Its demonstrated path initializes the kernel, discovers storage, mounts an EXT2 volume, and launches an ELF user program; the user-space shell then provides filesystem commands. Separate capabilities include process scheduling, device and memory support, and networking. The graph reflects direct calls visible in the excerpts and capabilities stated in the README; unsampled networking and syscall wiring is kept deliberately sparse.

Main entry points: [`kernel/kernel.c`](https://github.com/itaiaviad/bios/blob/main/kernel/kernel.c) (Kernel startup), [`kernel/arch/x86_64/vfs.c`](https://github.com/itaiaviad/bios/blob/main/kernel/arch/x86_64/vfs.c) (Virtual filesystem), [`kernel/driver/disk.c`](https://github.com/itaiaviad/bios/blob/main/kernel/driver/disk.c) (Disk interface), [`kernel/process/elf.c`](https://github.com/itaiaviad/bios/blob/main/kernel/process/elf.c) (ELF loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_boot["Kernel Core"]
  node_kernel["Kernel startup<br/>[kernel.c]"]
  node_interrupts["Interrupt handling<br/>[interrupts.c]"]
  node_memory["Paging and heap<br/>[mmu.c]"]
  node_pci["PCI discovery<br/>[pci.c]"]
end

subgraph group_storage["Storage and Filesystem"]
  node_disk["Disk interface<br/>[disk.c]"]
  node_ahci["AHCI SATA driver<br/>[ahci.c]"]
  node_vfs["Virtual filesystem<br/>[vfs.c]"]
  node_ext2["EXT2 reader<br/>[ext2.c]"]
  node_diskstore[("EXT2 disk volume")]
end

subgraph group_userspace["Processes and User Space"]
  node_process["Process management<br/>[process.c]"]
  node_elf["ELF loader<br/>[elf.c]"]
  node_scheduler["Process scheduler<br/>[sched.c]"]
  node_shell["User shell<br/>[shell.c]"]
  node_shellfs["Shell filesystem commands<br/>[fs.c]"]
  node_shellnet["Shell network commands<br/>[net.c]"]
end

subgraph group_network["Networking"]
  node_rtl["RTL8139 driver<br/>[rtl8139.c]"]
  node_ethernet["Ethernet<br/>[ethernet.c]"]
  node_arp["ARP<br/>[arp.c]"]
  node_ipv4["IPv4<br/>[ipv4.c]"]
  node_udp["UDP and ports<br/>[udp.c]"]
  node_dns["DNS<br/>[dns.c]"]
end

subgraph group_libc["C Library"]
  node_libcfiles["File operations<br/>[file_op.c]"]
  node_libcstdio["Standard I/O<br/>[stdio.c]"]
  node_libcmemory["Memory allocation<br/>[malloc.c]"]
end

node_operator(("User"))

node_kernel -->|"initializes"| node_interrupts
node_kernel -->|"initializes"| node_process
node_kernel -->|"enumerates"| node_pci
node_kernel -->|"enumerates disks"| node_disk
node_kernel -->|"initializes"| node_vfs
node_kernel -->|"initializes"| node_rtl
node_kernel -->|"mounts EXT2"| node_vfs
node_pci -->|"discovers device"| node_ahci
node_ahci -->|"registers drives"| node_disk
node_disk -->|"accesses"| node_diskstore
node_vfs -->|"calls EXT2 reader"| node_ext2
node_ext2 -->|"reads sectors"| node_disk
node_kernel -->|"executes program"| node_elf
node_elf -->|"loads file"| node_vfs
node_elf -->|"creates process"| node_process
node_process -->|"dispatches"| node_scheduler
node_operator -->|"uses"| node_shell
node_shell -->|"dispatches commands"| node_shellfs
node_shell -->|"dispatches commands"| node_shellnet
node_shellfs -->|"calls file APIs"| node_libcfiles
node_libcfiles -->|"reads and lists"| node_vfs
node_rtl -->|"handles frames"| node_ethernet
node_ethernet -->|"dispatches ARP"| node_arp

click node_kernel "https://github.com/itaiaviad/bios/blob/main/kernel/kernel.c"
click node_interrupts "https://github.com/itaiaviad/bios/blob/main/kernel/arch/x86_64/interrupts/interrupts.c"
click node_memory "https://github.com/itaiaviad/bios/blob/main/kernel/arch/x86_64/mmu/mmu.c"
click node_pci "https://github.com/itaiaviad/bios/blob/main/kernel/driver/pci.c"
click node_disk "https://github.com/itaiaviad/bios/blob/main/kernel/driver/disk.c"
click node_ahci "https://github.com/itaiaviad/bios/blob/main/kernel/driver/ahci.c"
click node_vfs "https://github.com/itaiaviad/bios/blob/main/kernel/arch/x86_64/vfs.c"
click node_ext2 "https://github.com/itaiaviad/bios/blob/main/kernel/driver/ext2.c"
click node_process "https://github.com/itaiaviad/bios/blob/main/kernel/process/process.c"
click node_elf "https://github.com/itaiaviad/bios/blob/main/kernel/process/elf.c"
click node_scheduler "https://github.com/itaiaviad/bios/blob/main/kernel/process/sched.c"
click node_shell "https://github.com/itaiaviad/bios/blob/main/user/shell/shell.c"
click node_shellfs "https://github.com/itaiaviad/bios/blob/main/user/shell/fs.c"
click node_shellnet "https://github.com/itaiaviad/bios/blob/main/user/shell/net.c"
click node_rtl "https://github.com/itaiaviad/bios/blob/main/kernel/net/rtl8139.c"
click node_ethernet "https://github.com/itaiaviad/bios/blob/main/kernel/net/ethernet.c"
click node_arp "https://github.com/itaiaviad/bios/blob/main/kernel/net/arp.c"
click node_ipv4 "https://github.com/itaiaviad/bios/blob/main/kernel/net/ipv4.c"
click node_udp "https://github.com/itaiaviad/bios/blob/main/kernel/net/udp.c"
click node_dns "https://github.com/itaiaviad/bios/blob/main/kernel/net/dns.c"
click node_libcfiles "https://github.com/itaiaviad/bios/blob/main/libc/file_op/file_op.c"
click node_libcstdio "https://github.com/itaiaviad/bios/blob/main/libc/stdio/stdio.c"
click node_libcmemory "https://github.com/itaiaviad/bios/blob/main/libc/memory/malloc.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_interrupts,node_memory,node_pci,node_operator toneBlue
class node_disk,node_ahci,node_vfs,node_ext2,node_diskstore toneAmber
class node_process,node_elf,node_scheduler,node_shell,node_shellfs,node_shellnet toneMint
class node_rtl,node_ethernet,node_arp,node_ipv4,node_udp,node_dns toneRose
class node_libcfiles,node_libcstdio,node_libcmemory toneIndigo
```

## Components

### Kernel Core

- [Kernel startup](https://github.com/itaiaviad/bios/blob/main/kernel/kernel.c): `kernel/kernel.c`
- [Interrupt handling](https://github.com/itaiaviad/bios/blob/main/kernel/arch/x86_64/interrupts/interrupts.c): `kernel/arch/x86_64/interrupts/interrupts.c`
- [Paging and heap](https://github.com/itaiaviad/bios/blob/main/kernel/arch/x86_64/mmu/mmu.c): `kernel/arch/x86_64/mmu/mmu.c`
- [PCI discovery](https://github.com/itaiaviad/bios/blob/main/kernel/driver/pci.c): `kernel/driver/pci.c`

### Storage and Filesystem

- [Disk interface](https://github.com/itaiaviad/bios/blob/main/kernel/driver/disk.c): `kernel/driver/disk.c`
- [AHCI SATA driver](https://github.com/itaiaviad/bios/blob/main/kernel/driver/ahci.c): `kernel/driver/ahci.c`
- [Virtual filesystem](https://github.com/itaiaviad/bios/blob/main/kernel/arch/x86_64/vfs.c): `kernel/arch/x86_64/vfs.c`
- [EXT2 reader](https://github.com/itaiaviad/bios/blob/main/kernel/driver/ext2.c): `kernel/driver/ext2.c`
- **EXT2 disk volume**

### Processes and User Space

- [Process management](https://github.com/itaiaviad/bios/blob/main/kernel/process/process.c): `kernel/process/process.c`
- [ELF loader](https://github.com/itaiaviad/bios/blob/main/kernel/process/elf.c): `kernel/process/elf.c`
- [Process scheduler](https://github.com/itaiaviad/bios/blob/main/kernel/process/sched.c): `kernel/process/sched.c`
- [User shell](https://github.com/itaiaviad/bios/blob/main/user/shell/shell.c): `user/shell/shell.c`
- [Shell filesystem commands](https://github.com/itaiaviad/bios/blob/main/user/shell/fs.c): `user/shell/fs.c`
- [Shell network commands](https://github.com/itaiaviad/bios/blob/main/user/shell/net.c): `user/shell/net.c`

### Networking

- [RTL8139 driver](https://github.com/itaiaviad/bios/blob/main/kernel/net/rtl8139.c): `kernel/net/rtl8139.c`
- [Ethernet](https://github.com/itaiaviad/bios/blob/main/kernel/net/ethernet.c): `kernel/net/ethernet.c`
- [ARP](https://github.com/itaiaviad/bios/blob/main/kernel/net/arp.c): `kernel/net/arp.c`
- [IPv4](https://github.com/itaiaviad/bios/blob/main/kernel/net/ipv4.c): `kernel/net/ipv4.c`
- [UDP and ports](https://github.com/itaiaviad/bios/blob/main/kernel/net/udp.c): `kernel/net/udp.c`
- [DNS](https://github.com/itaiaviad/bios/blob/main/kernel/net/dns.c): `kernel/net/dns.c`

### C Library

- [File operations](https://github.com/itaiaviad/bios/blob/main/libc/file_op/file_op.c): `libc/file_op/file_op.c`
- [Standard I/O](https://github.com/itaiaviad/bios/blob/main/libc/stdio/stdio.c): `libc/stdio/stdio.c`
- [Memory allocation](https://github.com/itaiaviad/bios/blob/main/libc/memory/malloc.c): `libc/memory/malloc.c`

### Other components

- **User**

## Connections

- Kernel startup → Interrupt handling: initializes
- Kernel startup → Process management: initializes
- Kernel startup → PCI discovery: enumerates
- Kernel startup → Disk interface: enumerates disks
- Kernel startup → Virtual filesystem: initializes
- Kernel startup → RTL8139 driver: initializes
- Kernel startup → Virtual filesystem: mounts EXT2
- PCI discovery → AHCI SATA driver: discovers device
- AHCI SATA driver → Disk interface: registers drives
- Disk interface → EXT2 disk volume: accesses
- Virtual filesystem → EXT2 reader: calls EXT2 reader
- EXT2 reader → Disk interface: reads sectors
- Kernel startup → ELF loader: executes program
- ELF loader → Virtual filesystem: loads file
- ELF loader → Process management: creates process
- Process management → Process scheduler: dispatches
- User → User shell: uses
- User shell → Shell filesystem commands: dispatches commands
- User shell → Shell network commands: dispatches commands
- Shell filesystem commands → File operations: calls file APIs
- File operations → Virtual filesystem: reads and lists
- RTL8139 driver → Ethernet: handles frames
- Ethernet → ARP: dispatches ARP
