diff options
Diffstat (limited to 'CONTEXT.md')
| -rw-r--r-- | CONTEXT.md | 39 |
1 files changed, 27 insertions, 12 deletions
| @@ -4,11 +4,12 @@ | |||
| 4 | 4 | ||
| 5 | Custom x86_64 kernel for the RNG ecosystem. Toy project — self-contained, | 5 | Custom x86_64 kernel for the RNG ecosystem. Toy project — self-contained, |
| 6 | no strict userspace separation, TempleOS-inspired design philosophy. | 6 | no strict userspace separation, TempleOS-inspired design philosophy. |
| 7 | Built in Rust, compiled for the `x86_64-unknown-uefi` target (nightly). | 7 | Built in Rust, compiled for the `x86_64-unknown-uefi` target (stable). |
| 8 | 8 | ||
| 9 | ## Boot interface | 9 | ## Boot interface |
| 10 | 10 | ||
| 11 | The kernel is a **PE32+ EFI application** loaded via UEFI `LoadImage`/`StartImage`. | 11 | The kernel is a **PE32+ EFI application** loaded via UEFI |
| 12 | `LoadImage`/`StartImage`. | ||
| 12 | The existing bootloader (rsbl) loads us from `\bzImage` and passes the UEFI | 13 | The existing bootloader (rsbl) loads us from `\bzImage` and passes the UEFI |
| 13 | system table. No bootloader changes needed. | 14 | system table. No bootloader changes needed. |
| 14 | 15 | ||
| @@ -56,9 +57,10 @@ same RAM. Contiguous runs with power-of-two alignment are supported | |||
| 56 | 57 | ||
| 57 | ## Input strategy | 58 | ## Input strategy |
| 58 | 59 | ||
| 59 | **PS/2 keyboard polling.** Port I/O to `0x60`/`0x64`. Scancode set 1 | 60 | **PS/2 keyboard, interrupt-driven.** IRQ1 pushes scancodes into a ring |
| 60 | (US QWERTY layout in the initial build). No interrupts — polling loop | 61 | buffer (`interrupts::KEYBUF`); the shell polls it via `read_scancode()`. |
| 61 | inside the shell. | 62 | Port I/O to `0x60`/`0x64`. Scancode set 1 (US QWERTY layout in the |
| 63 | initial build). | ||
| 62 | 64 | ||
| 63 | ## Display strategy | 65 | ## Display strategy |
| 64 | 66 | ||
| @@ -86,7 +88,14 @@ image as `\bzImage` (matching rsbl's expected path). | |||
| 86 | 88 | ||
| 87 | ## Project layout | 89 | ## Project layout |
| 88 | 90 | ||
| 89 | Single Rust crate (`x86_64-unknown-uefi` target). Module breakdown: | 91 | Workspace of four crates, all built for the `x86_64-unknown-uefi` target: |
| 92 | |||
| 93 | - `rsnix` — the kernel library (module breakdown below) | ||
| 94 | - `shell` — command loop and built-ins | ||
| 95 | - `rsdos` — EFI entry point (`efi_main`) and boot orchestration | ||
| 96 | - `rsdosedit` — kernel-native terminal editor | ||
| 97 | |||
| 98 | `rsnix` module breakdown: | ||
| 90 | 99 | ||
| 91 | - `main.rs` — entry point, panic handler, top-level init | 100 | - `main.rs` — entry point, panic handler, top-level init |
| 92 | - `uefi.rs` — UEFI protocol type definitions | 101 | - `uefi.rs` — UEFI protocol type definitions |
| @@ -97,14 +106,17 @@ Single Rust crate (`x86_64-unknown-uefi` target). Module breakdown: | |||
| 97 | - `paging.rs` — identity page-table helpers (map/unmap/query, large-page split) | 106 | - `paging.rs` — identity page-table helpers (map/unmap/query, large-page split) |
| 98 | - `power.rs` — `ResetSystem`-based shutdown, hlt loop fallback | 107 | - `power.rs` — `ResetSystem`-based shutdown, hlt loop fallback |
| 99 | - `rtc.rs` — CMOS/RTC clock (ports 0x70/0x71), BCD/12h normalization | 108 | - `rtc.rs` — CMOS/RTC clock (ports 0x70/0x71), BCD/12h normalization |
| 100 | - `pci.rs` — legacy PCI config space (0xCF8/0xCFC), full enumeration; `config_write` | 109 | - `pci.rs` — legacy PCI config space (0xCF8/0xCFC), full |
| 110 | enumeration; `config_write` | ||
| 101 | - 64-bit BAR reader for the AHCI driver | 111 | - 64-bit BAR reader for the AHCI driver |
| 102 | - `ahci.rs` — SATA AHCI host driver (polling, DMA, no interrupts): scans PCI for | 112 | - `ahci.rs` — SATA AHCI host driver (polling, DMA, no interrupts): scans PCI for |
| 103 | class 1/subclass 6/prog-if 1, maps ABAR, starts port 0 (FRE/ST/DMAE), runs | 113 | class 1/subclass 6/prog-if 1, maps ABAR, starts port 0 (FRE/ST/DMAE), runs |
| 104 | IDENTIFY + READ/WRITE DMA EXT through a 4 KiB DMA buffer | 114 | IDENTIFY + READ/WRITE DMA EXT through a 4 KiB DMA buffer |
| 105 | - `fat.rs` — FAT32: BPB parse, whole-FAT cache in RAM with write-back to both FAT | 115 | - `fat.rs` — FAT32: BPB parse, whole-FAT cache in RAM with |
| 116 | write-back to both FAT | ||
| 106 | copies, cluster chains, directory scan with checksum-validated LFN | 117 | copies, cluster chains, directory scan with checksum-validated LFN |
| 107 | reassembly, LFN + 8.3 writing, FSInfo free-count maintenance, mkdir/rm/read/write | 118 | reassembly, LFN + 8.3 writing, FSInfo free-count maintenance, |
| 119 | mkdir/rm/read/write | ||
| 108 | - `fs.rs` — VFS: dirs, ramfs files, char devices (`/dev/mem`, `rtc`, `pci`, | 120 | - `fs.rs` — VFS: dirs, ramfs files, char devices (`/dev/mem`, `rtc`, `pci`, |
| 109 | `version`, `meminfo`, `null`, `zero`, `console`, `serial`; `/tmp` ramfs; | 121 | `version`, `meminfo`, `null`, `zero`, `console`, `serial`; `/tmp` ramfs; |
| 110 | `/etc/motd`); `/disk` mount node + 24-slot ephemeral node pool so shell | 122 | `/etc/motd`); `/disk` mount node + 24-slot ephemeral node pool so shell |
| @@ -130,14 +142,17 @@ Single Rust crate (`x86_64-unknown-uefi` target). Module breakdown: | |||
| 130 | 142 | ||
| 131 | ## Milestone status (v0.1) | 143 | ## Milestone status (v0.1) |
| 132 | 144 | ||
| 133 | ✅ **Booting** — kernel loads via rsbl, prints banner via UEFI console (verified on real hardware) | 145 | ✅ **Booting** — kernel loads via rsbl, prints banner via UEFI |
| 146 | console (verified on real hardware) | ||
| 134 | ✅ **ExitBootServices** — memory map captured via static `.bss` buffer | 147 | ✅ **ExitBootServices** — memory map captured via static `.bss` buffer |
| 135 | (see `docs/adr/0001-static-buffer-for-memory-map.md`) | 148 | (see `docs/adr/0001-static-buffer-for-memory-map.md`) |
| 136 | ✅ **Serial** — UART 16550 at COM1, 115200 8N1 | 149 | ✅ **Serial** — UART 16550 at COM1, 115200 8N1 |
| 137 | ✅ **Framebuffer** — GOP located, 8×16 bitmap font renders text | 150 | ✅ **Framebuffer** — GOP located, 8×16 bitmap font renders text |
| 138 | ✅ **Keyboard** — PS/2 polling, scancode set 1, US QWERTY | 151 | ✅ **Keyboard** — PS/2 polling, scancode set 1, US QWERTY |
| 139 | ✅ **Shell** — commands: `help`, `echo`, `clear`, `hello`, `info`, `mem`, `halt`, `poweroff` | 152 | ✅ **Shell** — commands: `help`, `echo`, `clear`, `hello`, `info`, |
| 140 | ✅ **Heap allocator** — first-fit free-list with splitting + coalescing, `alloc`/`free` | 153 | `mem`, `halt`, `poweroff` |
| 154 | ✅ **Heap allocator** — first-fit free-list with splitting + | ||
| 155 | coalescing, `alloc`/`free` | ||
| 141 | (boot-time self-test verifies alignment, reuse, and full coalescing) | 156 | (boot-time self-test verifies alignment, reuse, and full coalescing) |
| 142 | ✅ **Physical pages** — bitmap allocator over conventional regions, contiguous | 157 | ✅ **Physical pages** — bitmap allocator over conventional regions, contiguous |
| 143 | runs, heap reservation, page-0 trap guard (boot-time self-test included) | 158 | runs, heap reservation, page-0 trap guard (boot-time self-test included) |
