Login
Check-in [d42b6f9487]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merge 5.7 (x86_64): Lazy guest memory

Reviewed against docs/tasks/5.7.md; verdict merge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TUH8KMXZyLk8eDgCjvQ9hX

Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d42b6f9487916a6442898ac53eb251ee1606a4215e56c57734736686dc516397
User & Date: x86-1-glint 2026-11-09 21:38:06.414
Context
2026-11-09
21:40
docs/boots: 5.7's lazy guest memory, and the first aarch64 boot from x86-1

Claim: the boots page gains 5.7's milestone (the guest backs only 32 KiB of its 16 MiB) and an aarch64 boot, the first since aarch64 could build here: Glint built inside BQ2's published seed, booting native at EL2 with its own page tables and placing the relocated guest image.

Passage: the maintainer's 'more ascii animations of glint as it progresses, please' (ocx-console 40c80385db).

Demonstration: both casts are files bin/glint-run wrote on x86-1 at trunk d42b6f9487 for the commands in their entries; both runs exited 0. BOOTAA64.EFI (201,728 bytes) was built inside the seed with bq2 sysroot-namespace.

Size: two casts, two entries in boots.js.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TUH8KMXZyLk8eDgCjvQ9hX check-in: c0224ab0dc user: x86-1-glint tags: trunk

21:38
Merge 5.7 (x86_64): Lazy guest memory

Reviewed against docs/tasks/5.7.md; verdict merge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TUH8KMXZyLk8eDgCjvQ9hX check-in: d42b6f9487 user: x86-1-glint tags: trunk

21:38
5.7 (x86_64): Lazy guest memory

Claim: the boot's guest RAM is backed one zeroed 4 KiB page at a time, from 3.1, on first touch. GuestSpace.new(size, lazy: true) allocates and maps nothing. back(gpa) maps one zeroed page, refusing addresses outside RAM, and translate backs a page before returning it, so Glint's own writes and reads (load, guest tables, GuestRange) work unchanged. free returns every backed page and table page. In the run loop, a final-stage nested-page fault on an unbacked page inside RAM is backed and the guest retries the same instruction. A fault on a backed page, or outside RAM, still stops it as 5.1 does. The CRC is computed through translate, and 'Guest space:' now says 'backed on first touch'. After power-off the boot prints how much was backed. The shell's guest_space command keeps the eager form.

Passage: xv6 §5.1 ('Lazy allocation') and Hailperin §6.2.7 ('Efficient Zero Filling'), paraphrased because the texts aren't in the workspace.

Demonstration: on x86-1 the Phase 4 demo prints 'VM: guest memory 32 KiB backed of 16384 KiB'. That's 8 pages: the 16 KiB image (4), the guest's page tables (3) and one stack page. The fixture's CRC is still 0x4765cbdb. The fault guest still reports its read at 0x1000000, past RAM and so never backed. spec/lazy_guest_space_spec.cr checks 0 pages at creation; back refused outside RAM and on the boundary and accepted on the last page; translate backing exactly the pages it crosses; free restoring 3.1's free count; and the CRC through translate equal to the contiguous one. With the guest-space, guest-load and image-check specs and the phase 3, phase 4, 5.1 and 5.3 boots: 45 examples, 0 failures, 8 pending (aarch64). Codex wrote it from docs/tasks/5.7.md; the reviewer checked that PageSource#allocate zeroes its page and made no changes.

Size: +92/-11 non-spec lines; largest changed function GuestSpace#initialize, 993 bytes; BOOTX64.EFI unchanged at 209,408 bytes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TUH8KMXZyLk8eDgCjvQ9hX Leaf check-in: 22e83daf6f user: x86-1-glint tags: slice/5.7-x86_64

21:36
Specs: two fixes found by running aarch64 inside BQ2's seed

Claim: spec/run/phase3_spec.cr expected 'Stack overflow:' twice on aarch64, so its first aarch64 run could never pass. It now expects 'Panic: data abort' and then 'Stack overflow: guard page', as the boot prints. spec/shell/matcher_spec.cr didn't require the grammar whose CALL_PATTERN it uses, so it compiled only when other spec files were in the same run. It now requires it.

Passage: The One Place's request (glint fc3d2664d0) to build inside BQ2's published seed and run the pending aarch64 specs.

Demonstration: inside the seed (bq2 sysroot-namespace, sha256 0c93201b... checked; llvm-config prints X86 ARM AArch64), spec/run/phase3_spec.cr gives 10 examples, 0 failures, 0 pending, and spec/shell/matcher_spec.cr alone gives 5 examples, 0 failures. Before these fixes the phase 3 aarch64 example failed on the second 'Stack overflow:', and the matcher spec alone stopped with 'undefined constant Glint::Shell::Grammar::CALL_PATTERN'. Both specs were written while aarch64 couldn't build here.

Size: one line changed and one added, in two specs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TUH8KMXZyLk8eDgCjvQ9hX check-in: 940e9790c7 user: x86-1-glint tags: trunk

Changes
Unified Diff Side-by-Side Diff Patch
Changes to boot/access.cr.
Changes to boot/guest_image.cr.
Changes to boot/native_table.cr.
Changes to boot/vcpu.cr.
Changes to mem/guest_space.cr.
Added spec/lazy_guest_space_spec.cr.
Changes to spec/run/phase3_spec.cr.
Changes to spec/run/phase4_spec.cr.