# piat0n/baremetal-ram-dumper architecture

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

- Interactive diagram: https://gitdiagram.com/piat0n/baremetal-ram-dumper
- Repository: https://github.com/piat0n/baremetal-ram-dumper

## Overview

BareMetal RAM Dumper is a BIOS-bootable x86 utility that copies valid physical RAM to the boot medium. The documented workflow starts when BIOS loads the boot sector; stage1 loads stage2, which checks disk support, discovers usable memory, copies it in chunks using unreal mode, and writes the dump beginning at LBA 64. The graph separates bootstrapping from dump processing while showing BIOS, RAM, and disk as external dependencies. No source excerpts were provided, so relationships are based on the README only.

Main entry points: [`stage2.asm`](https://github.com/piat0n/baremetal-ram-dumper/blob/main/stage2.asm) (Dump program), [`stage1.asm`](https://github.com/piat0n/baremetal-ram-dumper/blob/main/stage1.asm) (Boot sector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_boot["Bootloader"]
  node_stage1["Boot sector<br/>[stage1.asm]"]
end

subgraph group_dump["Dump engine"]
  node_stage2["Dump program<br/>[stage2.asm]"]
  node_e820["Memory map<br/>[stage2.asm]"]
  node_unreal["Unreal-mode copy<br/>[stage2.asm]"]
  node_diskwrite["Chunk writer<br/>[stage2.asm]"]
end

node_bios(("BIOS firmware"))
node_disk[("Boot medium")]
node_ram[("Physical RAM")]

node_bios -->|"boots"| node_stage1
node_stage1 -->|"requests read"| node_bios
node_bios -->|"loads"| node_stage2
node_stage1 -->|"reads LBA 1"| node_disk
node_stage2 -->|"queries EDD"| node_bios
node_stage2 -->|"queries map"| node_e820
node_e820 -->|"limits RAM scan"| node_stage2
node_stage2 -->|"copies chunks"| node_unreal
node_unreal -->|"reads memory"| node_ram
node_unreal -->|"fills buffer"| node_diskwrite
node_diskwrite -->|"requests write"| node_bios
node_diskwrite -->|"writes from LBA 64"| node_disk

click node_stage1 "https://github.com/piat0n/baremetal-ram-dumper/blob/main/stage1.asm"
click node_stage2 "https://github.com/piat0n/baremetal-ram-dumper/blob/main/stage2.asm"
click node_e820 "https://github.com/piat0n/baremetal-ram-dumper/blob/main/stage2.asm"
click node_unreal "https://github.com/piat0n/baremetal-ram-dumper/blob/main/stage2.asm"
click node_diskwrite "https://github.com/piat0n/baremetal-ram-dumper/blob/main/stage2.asm"

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_stage1 toneBlue
class node_stage2,node_e820,node_unreal,node_diskwrite,node_disk,node_ram toneAmber
class node_bios toneIndigo
```

## Components

### Bootloader

- [Boot sector](https://github.com/piat0n/baremetal-ram-dumper/blob/main/stage1.asm): `stage1.asm`

### Dump engine

- [Dump program](https://github.com/piat0n/baremetal-ram-dumper/blob/main/stage2.asm): `stage2.asm`
- [Memory map](https://github.com/piat0n/baremetal-ram-dumper/blob/main/stage2.asm): `stage2.asm`
- [Unreal-mode copy](https://github.com/piat0n/baremetal-ram-dumper/blob/main/stage2.asm): `stage2.asm`
- [Chunk writer](https://github.com/piat0n/baremetal-ram-dumper/blob/main/stage2.asm): `stage2.asm`

### Other components

- **BIOS firmware**
- **Boot medium**
- **Physical RAM**

## Connections

- BIOS firmware → Boot sector: boots (evidence: `README.md`)
- Boot sector → BIOS firmware: requests read (evidence: `README.md`)
- BIOS firmware → Dump program: loads (evidence: `README.md`)
- Boot sector → Boot medium: reads LBA 1 (evidence: `README.md`)
- Dump program → BIOS firmware: queries EDD (evidence: `README.md`)
- Dump program → Memory map: queries map (evidence: `README.md`)
- Memory map → Dump program: limits RAM scan (evidence: `README.md`)
- Dump program → Unreal-mode copy: copies chunks (evidence: `README.md`)
- Unreal-mode copy → Physical RAM: reads memory (evidence: `README.md`)
- Unreal-mode copy → Chunk writer: fills buffer (evidence: `README.md`)
- Chunk writer → BIOS firmware: requests write (evidence: `README.md`)
- Chunk writer → Boot medium: writes from LBA 64 (evidence: `README.md`)
