memory: the SMP crash is SMP-only, and what the font work cost

Two notes worth keeping out of the commit log because they are about where to
start next time rather than what changed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Nexoniarz 2026-09-21 21:05:52 +02:00
commit e577791e5e
3 changed files with 78 additions and 0 deletions

View file

@ -84,3 +84,37 @@ is on the tested path rather than bypassed by the harness.
béziers. Roughly the size of everything else here, and a subtly wrong
interpreter draws plausible-looking wrong glyphs. It plugs in as a third
`font_ops` provider, so nothing above it changes.
## 2026-09-21: it is the console font now
Linked into the kernel image (`consfont` in the Makefile), opened at 16 px
before `vt_init()`. Three things had to be fixed first, and two of them were
the same bug twice:
- **`ttf_render` held 21 KB of locals** on a 4096-byte kernel stack. Now
`static`, safe because every caller is serialised behind `cons.lock`.
- **`load_outline` did it again, recursively**, with a 4736-byte outline per
level. Composite glyphs are exactly Ą/Ę/Ś/Ł/Ż, so the second crash arrived
the moment the first fix let Unicode reach the screen and looked like a
fresh bug. Static outline per level, depth capped at 4 (the font's real
maximum nesting is 2), and `load_simple()` split out so the leaf's 512-byte
flag array is not multiplied by depth.
- **Component transforms were being skipped.** `'` is the comma glyph scaled
by -1 — a 180° rotation — and its offset only lands right after the
rotation. Without it the mark went 12 px into a 10 px cell and was clipped
away, so the character read as *missing from the font* rather than as
misplaced. F2Dot14 2x2 is applied now.
Neither stack bug showed in `tools/ttftest`, which has an 8 MB stack. **That is
the standing hazard of this file**: one source built for host and kernel, and
the host is most forgiving about exactly the resource the kernel is strictest
about. Check frame sizes with `llvm-objdump -d` on the kernel object, not the
host build.
The harness speaks UTF-8 now. Iterating bytes meant it could only ask for
ASCII, and ASCII is entirely simple glyphs — it could not reach the path that
mattered.
Glyph cache: 95 reserved ASCII slots plus 224 shared slots keyed by codepoint,
64 KB pool, flushed whole when it fills.