# alejoaquili/x64barebones architecture

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

- Interactive diagram: https://gitdiagram.com/alejoaquili/x64barebones
- Repository: https://github.com/alejoaquili/x64barebones

## Overview

x64BareBones is a minimal Intel 64-bit operating-system development project: a bootable kernel with support for separately packaged and loaded binary modules. The documented workflow is to package a kernel with modules, boot the system, load modules, and run kernel code that demonstrates a sample module. The repository also includes the Pure64 bootloader and a BMFS disk-image utility. Connections among these larger subsystems are limited where their implementations were not sampled; dashed edges indicate unverified integration.

Main entry points: [`Kernel/kernel.c`](https://github.com/alejoaquili/x64barebones/blob/master/Kernel/kernel.c) (Kernel startup and main), [`Toolchain/ModulePacker/main.c`](https://github.com/alejoaquili/x64barebones/blob/master/Toolchain/ModulePacker/main.c) (Module packer), [`Kernel/moduleLoader.c`](https://github.com/alejoaquili/x64barebones/blob/master/Kernel/moduleLoader.c) (Module loader), [`Userland/SampleCodeModule/sampleCodeModule.c`](https://github.com/alejoaquili/x64barebones/blob/master/Userland/SampleCodeModule/sampleCodeModule.c) (Sample code module)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_boot["Boot and disk"]
  node_pure64["Pure64 bootloader"]
  node_bmfs["BMFS utility<br/>[bmfs.c]"]
  node_disk[("BMFS disk image")]
end

subgraph group_kernel["Kernel runtime"]
  node_kernel["Kernel startup and main<br/>[kernel.c]"]
  node_console["Naive console<br/>[naiveConsole.c]"]
  node_memory["Memory routines<br/>[lib.c]"]
  node_module_loader["Module loader<br/>[moduleLoader.c]"]
end

subgraph group_modules["Binary modules"]
  node_sample_loader["Module entry stub<br/>[_loader.c]"]
  node_sample_code["Sample code module<br/>[sampleCodeModule.c]"]
end

subgraph group_tools["Packaging"]
  node_packer["Module packer<br/>[main.c]"]
  node_packer_format["Packed image format<br/>[modulePacker.h]"]
end

node_developer(("Developer"))

node_developer -->|"packages binaries"| node_packer
node_packer -->|"builds image"| node_packer_format
node_packer -->|"includes kernel"| node_kernel
node_packer -->|"appends modules"| node_sample_code
node_pure64 -.->|"starts kernel"| node_kernel
node_kernel -->|"loads modules"| node_module_loader
node_module_loader -->|"copies bytes"| node_memory
node_kernel -->|"prints status"| node_console
node_module_loader -->|"prints progress"| node_console
node_kernel -->|"calls module"| node_sample_code
node_sample_code -.->|"starts via stub"| node_sample_loader
node_packer_format -.->|"supplies payload"| node_module_loader
node_developer -->|"runs commands"| node_bmfs
node_bmfs -->|"reads and writes"| node_disk

click node_pure64 "https://github.com/alejoaquili/x64barebones/tree/master/Bootloader/Pure64/src"
click node_bmfs "https://github.com/alejoaquili/x64barebones/blob/master/Bootloader/BMFS/bmfs.c"
click node_kernel "https://github.com/alejoaquili/x64barebones/blob/master/Kernel/kernel.c"
click node_console "https://github.com/alejoaquili/x64barebones/blob/master/Kernel/naiveConsole.c"
click node_memory "https://github.com/alejoaquili/x64barebones/blob/master/Kernel/lib.c"
click node_module_loader "https://github.com/alejoaquili/x64barebones/blob/master/Kernel/moduleLoader.c"
click node_packer "https://github.com/alejoaquili/x64barebones/blob/master/Toolchain/ModulePacker/main.c"
click node_packer_format "https://github.com/alejoaquili/x64barebones/blob/master/Toolchain/ModulePacker/modulePacker.h"
click node_sample_loader "https://github.com/alejoaquili/x64barebones/blob/master/Userland/SampleCodeModule/_loader.c"
click node_sample_code "https://github.com/alejoaquili/x64barebones/blob/master/Userland/SampleCodeModule/sampleCodeModule.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_pure64,node_bmfs,node_disk toneBlue
class node_kernel,node_console,node_memory,node_module_loader toneAmber
class node_sample_loader,node_sample_code toneMint
class node_packer,node_packer_format toneRose
class node_developer toneIndigo
```

## Components

### Boot and disk

- [Pure64 bootloader](https://github.com/alejoaquili/x64barebones/tree/master/Bootloader/Pure64/src): `Bootloader/Pure64/src`
- [BMFS utility](https://github.com/alejoaquili/x64barebones/blob/master/Bootloader/BMFS/bmfs.c): `Bootloader/BMFS/bmfs.c`
- **BMFS disk image**

### Kernel runtime

- [Kernel startup and main](https://github.com/alejoaquili/x64barebones/blob/master/Kernel/kernel.c): `Kernel/kernel.c`
- [Naive console](https://github.com/alejoaquili/x64barebones/blob/master/Kernel/naiveConsole.c): `Kernel/naiveConsole.c`
- [Memory routines](https://github.com/alejoaquili/x64barebones/blob/master/Kernel/lib.c): `Kernel/lib.c`
- [Module loader](https://github.com/alejoaquili/x64barebones/blob/master/Kernel/moduleLoader.c): `Kernel/moduleLoader.c`

### Binary modules

- [Module entry stub](https://github.com/alejoaquili/x64barebones/blob/master/Userland/SampleCodeModule/_loader.c): `Userland/SampleCodeModule/_loader.c`
- [Sample code module](https://github.com/alejoaquili/x64barebones/blob/master/Userland/SampleCodeModule/sampleCodeModule.c): `Userland/SampleCodeModule/sampleCodeModule.c`

### Packaging

- [Module packer](https://github.com/alejoaquili/x64barebones/blob/master/Toolchain/ModulePacker/main.c): `Toolchain/ModulePacker/main.c`
- [Packed image format](https://github.com/alejoaquili/x64barebones/blob/master/Toolchain/ModulePacker/modulePacker.h): `Toolchain/ModulePacker/modulePacker.h`

### Other components

- **Developer**

## Connections

- Developer → Module packer: packages binaries (evidence: `Toolchain/ModulePacker/main.c`)
- Module packer → Packed image format: builds image (evidence: `Toolchain/ModulePacker/main.c`)
- Module packer → Kernel startup and main: includes kernel (evidence: `Toolchain/ModulePacker/main.c`)
- Module packer → Sample code module: appends modules (evidence: `Toolchain/ModulePacker/main.c`)
- Pure64 bootloader → Kernel startup and main: starts kernel
- Kernel startup and main → Module loader: loads modules (evidence: `Kernel/kernel.c`)
- Module loader → Memory routines: copies bytes (evidence: `Kernel/moduleLoader.c`)
- Kernel startup and main → Naive console: prints status (evidence: `Kernel/kernel.c`)
- Module loader → Naive console: prints progress (evidence: `Kernel/moduleLoader.c`)
- Kernel startup and main → Sample code module: calls module (evidence: `Kernel/kernel.c`)
- Sample code module → Module entry stub: starts via stub
- Packed image format → Module loader: supplies payload
- Developer → BMFS utility: runs commands (evidence: `Bootloader/BMFS/bmfs.c`)
- BMFS utility → BMFS disk image: reads and writes (evidence: `Bootloader/BMFS/bmfs.c`)
