diff options
| author | salmonik <salmonik@tuta.io> | 2026-08-01 16:19:45 +0200 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-08-01 16:19:45 +0200 |
| commit | ce43cb9554d443f12af886ee035a73bf9b322ac5 (patch) | |
| tree | 4611a08b2596ab49c25793f20e126b66fea26169 /CONTEXT.md | |
| parent | rsnix: formatting (diff) | |
| download | rs-dos-ce43cb9554d443f12af886ee035a73bf9b322ac5.tar.gz rs-dos-ce43cb9554d443f12af886ee035a73bf9b322ac5.zip | |
docs: ADR 0003 (preemptive kernel tasks) + task glossary terms
- ADR 0003: preemptive round-robin kernel tasks on the 100 Hz tick,
shared address space, guard pages + page-fault handler, graceful task
panics, safe-builtin spawn surface, only-shell-touches-I/O invariant
- CONTEXT.md: new 'Task' glossary entry; 'Paging strategy' now says
guard pages exist on task stacks
Diffstat (limited to '')
| -rw-r--r-- | CONTEXT.md | 17 |
1 files changed, 16 insertions, 1 deletions
| @@ -32,7 +32,9 @@ structs are hand-defined (not from `uefi-rs` crate) to stay lightweight. | |||
| 32 | 32 | ||
| 33 | Long mode mandates paging (`CR0.PG = 1`), so we accept that tax but keep it | 33 | Long mode mandates paging (`CR0.PG = 1`), so we accept that tax but keep it |
| 34 | simple. Identity-mapped 4-level tables, no higher-half, no demand paging, | 34 | simple. Identity-mapped 4-level tables, no higher-half, no demand paging, |
| 35 | no guard pages. `paging.rs` provides identity map/unmap/query helpers. At | 35 | no guard pages except task stacks — each task's stack gets one unmapped |
| 36 | guard page below it, and a page-fault handler turns an overflow into a | ||
| 37 | task panic. `paging.rs` provides identity map/unmap/query helpers. At | ||
| 36 | boot the kernel runs on UEFI's tables; `adopt_tables()` rebuilds that map | 38 | boot the kernel runs on UEFI's tables; `adopt_tables()` rebuilds that map |
| 37 | into the kernel's own tables and switches CR3 — needed because UEFI maps its | 39 | into the kernel's own tables and switches CR3 — needed because UEFI maps its |
| 38 | page-table pages read-only, so the firmware tree can't be modified in place. | 40 | page-table pages read-only, so the firmware tree can't be modified in place. |
| @@ -80,6 +82,19 @@ linear frame buffer is system memory that we own once boot services are gone. | |||
| 80 | Scancode set 1, US QWERTY layout. Hardcoded scancode→ASCII table. | 82 | Scancode set 1, US QWERTY layout. Hardcoded scancode→ASCII table. |
| 81 | Other layouts can be added later by swapping the translation table. | 83 | Other layouts can be added later by swapping the translation table. |
| 82 | 84 | ||
| 85 | ## Task | ||
| 86 | |||
| 87 | A unit of concurrent execution in the kernel: its own kernel stack | ||
| 88 | (with a guard page below it), scheduler bookkeeping, and no | ||
| 89 | address-space separation — all tasks share the one identity-mapped | ||
| 90 | space and the kernel's facilities (TempleOS-style, not a process). | ||
| 91 | Tasks are preemptively round-robin-scheduled on the 100 Hz PIT tick; | ||
| 92 | the shell is task 0 and an idle `hlt` task is the always-ready | ||
| 93 | fallback. A task may sleep, yield, and log to serial/klog; only the | ||
| 94 | shell touches the disk, filesystem, and terminal. A panicking or | ||
| 95 | stack-overflowing task dies gracefully (logged, marked done, slot | ||
| 96 | reaped) without taking the kernel down. | ||
| 97 | |||
| 83 | ## Development loop | 98 | ## Development loop |
| 84 | 99 | ||
| 85 | Standalone project — no integration with the RNG initramfs build system. | 100 | Standalone project — no integration with the RNG initramfs build system. |
