# feue256/coresys architecture

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

- Interactive diagram: https://gitdiagram.com/feue256/coresys
- Repository: https://github.com/feue256/coresys

## Overview

CoreSys is an experimental, UEFI-native operating system, intended to boot on firmware and proceed into initialization, a custom kernel, and modular hardware services. The README also describes framebuffer output, memory management, and an early text interface; these are represented as planned capabilities, not as verified working end-to-end features. The tree contains two substantial additional products: a GPT disk-image utility and a Lua interpreter implementation. Source excerpts provide limited evidence for runtime wiring, so uncertain links are omitted or marked unverified.

Main entry points: [`src/CoreSys/kernel/main.c`](https://github.com/feue256/coresys/blob/master/src/CoreSys/kernel/main.c) (Kernel Core), [`src/CoreSys/kernel/drivers`](https://github.com/feue256/coresys/tree/master/src/CoreSys/kernel/drivers) (Driver Services), [`src/lua/lparser.c`](https://github.com/feue256/coresys/blob/master/src/lua/lparser.c) (Lua Parser), [`src/GPT/main.c`](https://github.com/feue256/coresys/blob/master/src/GPT/main.c) (GPT Image Builder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_os["CoreSys OS"]
  node_bootloader["UEFI Bootloader<br/>[main.c]"]
  node_initializer["System Initialization<br/>[main.c]"]
  node_kernel["Kernel Core<br/>[main.c]"]
  node_drivers["Driver Services"]
  node_memory["Memory Management<br/>[main.h]"]
  node_framebuffer["Framebuffer Output<br/>[main.h]"]
  node_textui["Text Interface<br/>[main.h]"]
end

subgraph group_gpt["GPT Utility"]
  node_gpttool["GPT Image Builder<br/>[main.c]"]
  node_diskimage["Disk Image"]
end

subgraph group_lua["Lua Runtime"]
  node_luaapi["Lua API<br/>[lua.h]"]
  node_lexer["Lua Lexer<br/>[llex.h]"]
  node_parser["Lua Parser<br/>[lparser.c]"]
  node_bytecode["Bytecode Generation<br/>[lcode.h]"]
  node_vm["Virtual Machine<br/>[lvm.c]"]
  node_runtime_state["Runtime State<br/>[lstate.h]"]
  node_lua_cli["Lua Command Line<br/>[lua.c]"]
end

node_firmware(("UEFI Firmware"))

node_firmware -.->|"starts"| node_bootloader
node_bootloader -.->|"hands off"| node_initializer
node_initializer -.->|"initializes"| node_kernel
node_kernel -.->|"uses services"| node_drivers
node_kernel -.->|"manages memory"| node_memory
node_drivers -.->|"provides graphics"| node_framebuffer
node_drivers -.->|"provides interface"| node_textui
node_gpttool -->|"writes image"| node_diskimage
node_gpttool -->|"uses GPT structures"| node_diskimage
node_parser -->|"reads tokens"| node_lexer
node_parser -->|"emits code"| node_bytecode
node_lua_cli -.->|"loads scripts"| node_parser
node_lua_cli -.->|"runs scripts"| node_vm
node_vm -.->|"uses state"| node_runtime_state
node_luaapi -.->|"exposes state API"| node_runtime_state

click node_bootloader "https://github.com/feue256/coresys/blob/master/src/CoreSys/bootloader/main.c"
click node_initializer "https://github.com/feue256/coresys/blob/master/src/CoreSys/init/main.c"
click node_kernel "https://github.com/feue256/coresys/blob/master/src/CoreSys/kernel/main.c"
click node_drivers "https://github.com/feue256/coresys/tree/master/src/CoreSys/kernel/drivers"
click node_memory "https://github.com/feue256/coresys/blob/master/src/CoreSys/kernel/drivers/page/main.h"
click node_framebuffer "https://github.com/feue256/coresys/blob/master/src/CoreSys/kernel/drivers/vga/main.h"
click node_textui "https://github.com/feue256/coresys/blob/master/src/CoreSys/kernel/drivers/tty/main.h"
click node_gpttool "https://github.com/feue256/coresys/blob/master/src/GPT/main.c"
click node_luaapi "https://github.com/feue256/coresys/blob/master/src/lua/lua.h"
click node_lexer "https://github.com/feue256/coresys/blob/master/src/lua/llex.h"
click node_parser "https://github.com/feue256/coresys/blob/master/src/lua/lparser.c"
click node_bytecode "https://github.com/feue256/coresys/blob/master/src/lua/lcode.h"
click node_vm "https://github.com/feue256/coresys/blob/master/src/lua/lvm.c"
click node_runtime_state "https://github.com/feue256/coresys/blob/master/src/lua/lstate.h"
click node_lua_cli "https://github.com/feue256/coresys/blob/master/src/lua/lua.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_bootloader,node_initializer,node_kernel,node_drivers,node_memory,node_framebuffer,node_textui toneBlue
class node_gpttool,node_diskimage toneAmber
class node_luaapi,node_lexer,node_parser,node_bytecode,node_vm,node_runtime_state,node_lua_cli toneMint
class node_firmware toneIndigo
```

## Components

### CoreSys OS

- [UEFI Bootloader](https://github.com/feue256/coresys/blob/master/src/CoreSys/bootloader/main.c): `src/CoreSys/bootloader/main.c`
- [System Initialization](https://github.com/feue256/coresys/blob/master/src/CoreSys/init/main.c): `src/CoreSys/init/main.c`
- [Kernel Core](https://github.com/feue256/coresys/blob/master/src/CoreSys/kernel/main.c): `src/CoreSys/kernel/main.c`
- [Driver Services](https://github.com/feue256/coresys/tree/master/src/CoreSys/kernel/drivers): `src/CoreSys/kernel/drivers`
- [Memory Management](https://github.com/feue256/coresys/blob/master/src/CoreSys/kernel/drivers/page/main.h): `src/CoreSys/kernel/drivers/page/main.h`
- [Framebuffer Output](https://github.com/feue256/coresys/blob/master/src/CoreSys/kernel/drivers/vga/main.h): `src/CoreSys/kernel/drivers/vga/main.h`
- [Text Interface](https://github.com/feue256/coresys/blob/master/src/CoreSys/kernel/drivers/tty/main.h): `src/CoreSys/kernel/drivers/tty/main.h`

### GPT Utility

- [GPT Image Builder](https://github.com/feue256/coresys/blob/master/src/GPT/main.c): `src/GPT/main.c`
- **Disk Image**

### Lua Runtime

- [Lua API](https://github.com/feue256/coresys/blob/master/src/lua/lua.h): `src/lua/lua.h`
- [Lua Lexer](https://github.com/feue256/coresys/blob/master/src/lua/llex.h): `src/lua/llex.h`
- [Lua Parser](https://github.com/feue256/coresys/blob/master/src/lua/lparser.c): `src/lua/lparser.c`
- [Bytecode Generation](https://github.com/feue256/coresys/blob/master/src/lua/lcode.h): `src/lua/lcode.h`
- [Virtual Machine](https://github.com/feue256/coresys/blob/master/src/lua/lvm.c): `src/lua/lvm.c`
- [Runtime State](https://github.com/feue256/coresys/blob/master/src/lua/lstate.h): `src/lua/lstate.h`
- [Lua Command Line](https://github.com/feue256/coresys/blob/master/src/lua/lua.c): `src/lua/lua.c`

### Other components

- **UEFI Firmware**

## Connections

- UEFI Firmware → UEFI Bootloader: starts
- UEFI Bootloader → System Initialization: hands off
- System Initialization → Kernel Core: initializes
- Kernel Core → Driver Services: uses services
- Kernel Core → Memory Management: manages memory
- Driver Services → Framebuffer Output: provides graphics
- Driver Services → Text Interface: provides interface
- GPT Image Builder → Disk Image: writes image (evidence: `src/GPT/main.c`)
- GPT Image Builder → Disk Image: uses GPT structures (evidence: `src/GPT/main.c`)
- Lua Parser → Lua Lexer: reads tokens (evidence: `src/lua/lparser.c`)
- Lua Parser → Bytecode Generation: emits code (evidence: `src/lua/lparser.c`)
- Lua Command Line → Lua Parser: loads scripts
- Lua Command Line → Virtual Machine: runs scripts
- Virtual Machine → Runtime State: uses state
- Lua API → Runtime State: exposes state API (evidence: `src/lua/lstate.h`)
