# guilhermegiacomosimoes/big_green_os architecture

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

## Overview

This is an under-development x86 kernel, with an additional AVR boot-sector source. The clearest user-facing workflow is keyboard input through the PS/2 handler, command dispatch to the shell, and VGA text output; kernel startup installs interrupts and registers the keyboard handler. The sampled source supports these runtime links and the VGA-to-memory copy. Boot loading details and some interrupt assembly are not sampled, so their wiring is left unspecified.

Main entry points: [`drivers/keyboard/ibmpc-ps2.c`](https://github.com/guilhermegiacomosimoes/big_green_os/blob/master/drivers/keyboard/ibmpc-ps2.c) (PS/2 handler), [`arch/x86/io/vga.c`](https://github.com/guilhermegiacomosimoes/big_green_os/blob/master/arch/x86/io/vga.c) (VGA text output), [`arch/x86/kernel.c`](https://github.com/guilhermegiacomosimoes/big_green_os/blob/master/arch/x86/kernel.c) (Kernel startup), [`client/shell.c`](https://github.com/guilhermegiacomosimoes/big_green_os/blob/master/client/shell.c) (Command shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Boot and startup"]
  node_x86boot["x86 boot code"]
  node_avrboot["AVR boot sector<br/>[mbr.asm]"]
  node_kernel["Kernel startup<br/>[kernel.c]"]
end

subgraph group_interrupts["Interrupt handling"]
  node_isr["ISR and IRQ setup<br/>[int.c]"]
end

subgraph group_interaction["Keyboard and shell"]
  node_keyboardinit["Keyboard registration<br/>[keyboard.c]"]
  node_ps2["PS/2 handler<br/>[ibmpc-ps2.c]"]
  node_shell["Command shell<br/>[shell.c]"]
end

subgraph group_platform["Platform and runtime"]
  node_portio["Port I/O<br/>[helper.c]"]
  node_vga["VGA text output<br/>[vga.c]"]
  node_memlib["Memory operations<br/>[memory.c]"]
  node_strlib["String operations<br/>[string.c]"]
  node_allocator["Kernel allocator<br/>[alocated.c]"]
end

node_user(("Keyboard user"))

node_kernel -->|"prints startup"| node_vga
node_kernel -->|"installs interrupts"| node_isr
node_kernel -->|"initializes keyboard"| node_keyboardinit
node_isr -->|"configures PIC"| node_portio
node_keyboardinit -->|"registers handler"| node_isr
node_user -->|"presses keys"| node_ps2
node_ps2 -->|"reads scancode"| node_portio
node_ps2 -->|"dispatches command"| node_shell
node_ps2 -->|"prints input"| node_vga
node_ps2 -->|"uses string helpers"| node_strlib
node_shell -->|"compares command"| node_strlib
node_shell -->|"prints response"| node_vga
node_vga -->|"scrolls screen"| node_memlib

click node_x86boot "https://github.com/guilhermegiacomosimoes/big_green_os/tree/master/arch/x86/boot"
click node_avrboot "https://github.com/guilhermegiacomosimoes/big_green_os/blob/master/arch/avr/boot/mbr.asm"
click node_kernel "https://github.com/guilhermegiacomosimoes/big_green_os/blob/master/arch/x86/kernel.c"
click node_isr "https://github.com/guilhermegiacomosimoes/big_green_os/blob/master/arch/x86/io/int.c"
click node_portio "https://github.com/guilhermegiacomosimoes/big_green_os/blob/master/arch/x86/io/helper.c"
click node_keyboardinit "https://github.com/guilhermegiacomosimoes/big_green_os/blob/master/drivers/keyboard/keyboard.c"
click node_ps2 "https://github.com/guilhermegiacomosimoes/big_green_os/blob/master/drivers/keyboard/ibmpc-ps2.c"
click node_shell "https://github.com/guilhermegiacomosimoes/big_green_os/blob/master/client/shell.c"
click node_vga "https://github.com/guilhermegiacomosimoes/big_green_os/blob/master/arch/x86/io/vga.c"
click node_memlib "https://github.com/guilhermegiacomosimoes/big_green_os/blob/master/lib/memory.c"
click node_strlib "https://github.com/guilhermegiacomosimoes/big_green_os/blob/master/lib/string.c"
click node_allocator "https://github.com/guilhermegiacomosimoes/big_green_os/blob/master/memory/alocated.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_x86boot,node_avrboot,node_kernel,node_user toneBlue
class node_isr toneAmber
class node_keyboardinit,node_ps2,node_shell toneMint
class node_portio,node_vga,node_memlib,node_strlib,node_allocator toneRose
```

## Components

### Boot and startup

- [x86 boot code](https://github.com/guilhermegiacomosimoes/big_green_os/tree/master/arch/x86/boot): `arch/x86/boot`
- [AVR boot sector](https://github.com/guilhermegiacomosimoes/big_green_os/blob/master/arch/avr/boot/mbr.asm): `arch/avr/boot/mbr.asm`
- [Kernel startup](https://github.com/guilhermegiacomosimoes/big_green_os/blob/master/arch/x86/kernel.c): `arch/x86/kernel.c`

### Interrupt handling

- [ISR and IRQ setup](https://github.com/guilhermegiacomosimoes/big_green_os/blob/master/arch/x86/io/int.c): `arch/x86/io/int.c`

### Keyboard and shell

- [Keyboard registration](https://github.com/guilhermegiacomosimoes/big_green_os/blob/master/drivers/keyboard/keyboard.c): `drivers/keyboard/keyboard.c`
- [PS/2 handler](https://github.com/guilhermegiacomosimoes/big_green_os/blob/master/drivers/keyboard/ibmpc-ps2.c): `drivers/keyboard/ibmpc-ps2.c`
- [Command shell](https://github.com/guilhermegiacomosimoes/big_green_os/blob/master/client/shell.c): `client/shell.c`

### Platform and runtime

- [Port I/O](https://github.com/guilhermegiacomosimoes/big_green_os/blob/master/arch/x86/io/helper.c): `arch/x86/io/helper.c`
- [VGA text output](https://github.com/guilhermegiacomosimoes/big_green_os/blob/master/arch/x86/io/vga.c): `arch/x86/io/vga.c`
- [Memory operations](https://github.com/guilhermegiacomosimoes/big_green_os/blob/master/lib/memory.c): `lib/memory.c`
- [String operations](https://github.com/guilhermegiacomosimoes/big_green_os/blob/master/lib/string.c): `lib/string.c`
- [Kernel allocator](https://github.com/guilhermegiacomosimoes/big_green_os/blob/master/memory/alocated.c): `memory/alocated.c`

### Other components

- **Keyboard user**

## Connections

- Kernel startup → VGA text output: prints startup
- Kernel startup → ISR and IRQ setup: installs interrupts
- Kernel startup → Keyboard registration: initializes keyboard
- ISR and IRQ setup → Port I/O: configures PIC
- Keyboard registration → ISR and IRQ setup: registers handler
- Keyboard user → PS/2 handler: presses keys
- PS/2 handler → Port I/O: reads scancode
- PS/2 handler → Command shell: dispatches command
- PS/2 handler → VGA text output: prints input
- PS/2 handler → String operations: uses string helpers
- Command shell → String operations: compares command
- Command shell → VGA text output: prints response
- VGA text output → Memory operations: scrolls screen
