summaryrefslogtreecommitdiffstats
path: root/CONTEXT.md
diff options
context:
space:
mode:
Diffstat (limited to 'CONTEXT.md')
-rw-r--r--CONTEXT.md36
1 files changed, 28 insertions, 8 deletions
diff --git a/CONTEXT.md b/CONTEXT.md
index c6bd5f9..86822d1 100644
--- a/CONTEXT.md
+++ b/CONTEXT.md
@@ -255,6 +255,34 @@ Workspace of four crates, all built for the `x86_64-unknown-uefi` target:
255 monitor (`--sock`, US layout, named keys for punctuation; bare 255 monitor (`--sock`, US layout, named keys for punctuation; bare
256 `-`/`.`/`/` are not valid sendkey names) 256 `-`/`.`/`/` are not valid sendkey names)
257 257
258✅ **`klog` kernel log ring** — a RAM ring of the last 128 serial log
259 lines (128 chars each, ~16 KB), fed by `serial_println!` (one choke
260 point — every boot/low-level message captured for free). Sequence
261 numbers per line + wrap/drop accounting; a dump header reports how
262 many lines were lost to wrap. Exposed as the `/dev/klog` char
263 device; the shell `klog` command is a thin alias for `cat
264 /dev/klog` (same filters/redirection), so `klog -t 5`, `klog -g
265 fat`, and `klog WRITING /disk/…/boot.log` (persists the boot log)
266 all work. The ring never allocates (const-constructible static);
267 only the dump allocates, at shell time. `klog` rejects positional
268 args (usage) and input keywords ("does not accept input").
269
270 **Design consequence: shell output must not feed the ring.** The
271 plan's "hook `serial_println!`" only works if that macro is
272 kernel-logging-only — but the shell printed prompts/errors/results
273 through it, which would have flooded the boot log with echo/cat
274 output (a `cat /dev/mem` would wrap the ring). The shell now
275 writes user-facing output (banner, prompt, `term_print`/
276 `term_println`, pipeline sink, halt/poweroff) directly to the
277 serial port via `serial::write_str`; tty echo already did. Only
278 kernel messages (rsnix modules + `rsdos/main.rs`) go through
279 `serial_println!` now. Verified in QEMU: 28 boot lines captured
280 (seq 0..27, first `=== rsnix boot ===`, last `boot: entering
281 shell`), `echo hello` output absent from the ring, `klog WRITING`
282 persists a boot log (mtype-verified), wrap behavior verified with a
283 temporary 140-line boot loop (128 kept / 40 dropped, seq 40..167,
284 oldest live line correct — loop reverted after the test).
285
258## Known issues / perf notes 286## Known issues / perf notes
259 287
260- **Scroll cost** — scrolling still shifts the whole framebuffer (a 288- **Scroll cost** — scrolling still shifts the whole framebuffer (a
@@ -289,14 +317,6 @@ Workspace of four crates, all built for the `x86_64-unknown-uefi` target:
289 317
290## Pending decisions (agreed, not yet implemented) 318## Pending decisions (agreed, not yet implemented)
291 319
292- **`klog` kernel log ring**: capture all boot/low-level messages by
293 appending to a RAM ring buffer inside `serial_println!` (one choke
294 point, every existing message captured for free). Ring: 128 lines ×
295 128 chars ≈ 16 KB, sequence numbers, wrap/drop accounting.
296- **`klog` command** = thin alias for `cat /dev/klog` plus filters
297 `-h` (head) and `-t` (tail); no log levels, no timestamps, nothing
298 fancier. `/dev/klog` is a char device so `klog WRITING /disk/…/boot.log`
299 persists a boot log via the existing redirection.
300- **Disk recognition scope — keep simple for now**: no pre-EBS UEFI 320- **Disk recognition scope — keep simple for now**: no pre-EBS UEFI
301 block-device census, no GPT/MBR partition parsing, no NVMe driver. 321 block-device census, no GPT/MBR partition parsing, no NVMe driver.
302 (Revisit later: Linux-style recognition = PCI scan → ahci/nvme → 322 (Revisit later: Linux-style recognition = PCI scan → ahci/nvme →