diff options
| author | salmonik <salmonik@tuta.io> | 2026-08-01 14:21:11 +0200 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-08-01 14:21:11 +0200 |
| commit | 6447eb12948d37b74adae2fdbf1db5a9d7b363d5 (patch) | |
| tree | 0aa03cc79db7ff49f5a64a484ff197ba05f9b6bc /CONTEXT.md | |
| parent | klog: kernel log ring + /dev/klog + klog shell command (diff) | |
| download | rs-dos-6447eb12948d37b74adae2fdbf1db5a9d7b363d5.tar.gz rs-dos-6447eb12948d37b74adae2fdbf1db5a9d7b363d5.zip | |
klog: [ssss.mmm] millisecond timestamps from the PIT
- interrupts::uptime_ms(): monotonic ms since boot — the 100 Hz PIT
tick (10 ms) plus interpolation from the PIT's live 1.19 MHz
down-counter (read twice around the tick load; a count jump means a
tick fired between reads) for true sub-ms resolution. TICKS widened
AtomicU16 -> AtomicU64 (u16 wrapped after ~11 min).
- PIT_READY gates interpolation until interrupts::init configures the
timer, so early-boot lines are deterministically [0000.000] instead
of uninitialised-PIT noise; klog clamps timestamps monotonic.
- The CMOS RTC cannot provide milliseconds (1 Hz BCD device, seconds
only) — millis come from the PIT.
- klog stores ms per line at append time; dump format is now
'[0000.123] 000000 === rsnix boot ===' (user-specified format).
Verified in QEMU: first line [0000.000], Phase-2 lines show real
monotonic ms (fs: vfs ready at [0000.519], self-test [0000.524]),
per-dump monotonicity, boot.log persists timestamps, test-disk round
trip fsck-clean.
Diffstat (limited to 'CONTEXT.md')
| -rw-r--r-- | CONTEXT.md | 13 |
1 files changed, 12 insertions, 1 deletions
| @@ -259,7 +259,18 @@ Workspace of four crates, all built for the `x86_64-unknown-uefi` target: | |||
| 259 | lines (128 chars each, ~16 KB), fed by `serial_println!` (one choke | 259 | lines (128 chars each, ~16 KB), fed by `serial_println!` (one choke |
| 260 | point — every boot/low-level message captured for free). Sequence | 260 | point — every boot/low-level message captured for free). Sequence |
| 261 | numbers per line + wrap/drop accounting; a dump header reports how | 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 | 262 | many lines were lost to wrap. Each line carries a `[ssss.mmm]` |
| 263 | timestamp — monotonic ms since boot from `interrupts::uptime_ms()`: | ||
| 264 | the 100 Hz PIT tick (10 ms) plus interpolation from the PIT's live | ||
| 265 | 1.19 MHz down-counter read twice around the tick load (a jump = a | ||
| 266 | tick fired between reads) for true sub-ms resolution; `TICKS` widened | ||
| 267 | to u64 so uptime never wraps. **The CMOS RTC cannot provide | ||
| 268 | milliseconds** — it is a 1 Hz BCD device (seconds only) — so the | ||
| 269 | millis come from the PIT. Early-boot lines are `[0000.000]` | ||
| 270 | (PIT not yet configured; `PIT_READY` gates interpolation), and | ||
| 271 | timestamps are clamped monotonic in the ring. | ||
| 272 | |||
| 273 | Exposed as the `/dev/klog` char | ||
| 263 | device; the shell `klog` command is a thin alias for `cat | 274 | device; the shell `klog` command is a thin alias for `cat |
| 264 | /dev/klog` (same filters/redirection), so `klog -t 5`, `klog -g | 275 | /dev/klog` (same filters/redirection), so `klog -t 5`, `klog -g |
| 265 | fat`, and `klog WRITING /disk/…/boot.log` (persists the boot log) | 276 | fat`, and `klog WRITING /disk/…/boot.log` (persists the boot log) |
