§H.12 step 3: session_set_pinned/session_is_pinned pin-authority choke point

session_is_pinned() reads Session.pinned directly (authoritative, no
Stadium re-derivation); session_set_pinned() writes both Session.pinned
and the mirrored STADIUM_FLAG_PIN bit on the session's own patron cell,
keeping Stadium's internal eviction/admission logic (which must stay
self-contained) in sync without it calling back into session.c.

Added Session.stadium_cell (index into stadium_cells()) -- necessary
plumbing not in the original H.2 field list; the choke point can't reach
the right patron header without it. Moved STADIUM_FLAG_PIN from a
stadium.c-private #define to stadium.h (public) so session.c can
reference it without a duplicate definition.

Verified 3-arch boot to ok> (amd64/aarch64/riscv64).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Robert Allan James
2026-09-03 06:10:11 -04:00
co-authored by Claude Opus 5
parent 6d9fe3f515
commit a621131ef6
13 changed files with 27670 additions and 8 deletions
+13 -2
View File
@@ -3955,8 +3955,19 @@ work, not new invention.
must run after `stadium_boot_init()`. Added `session.c` to `Makefile.starkernel`'s explicit
`LOADER_EXTRA_SRCS`/`KERNEL_EXTRA_SRCS` list (not a wildcard build). No callers yet.
Verified 3-arch boot to `ok>`.
3. `session_set_pinned()`/`session_is_pinned()` — the pin-authority choke point (H.2/H.10):
writes/reads `Session.pinned`, syncs `STADIUM_FLAG_PIN` on that VM's patron cell.
3. **DONE 2026-09-03, one addition found necessary.** `session_set_pinned()`/
`session_is_pinned()` implemented — the pin-authority choke point (H.2/H.10).
`session_is_pinned()` answers from `Session.pinned` directly (the authoritative copy, no
Stadium re-derivation); `session_set_pinned()` writes both `Session.pinned` and the
mirrored `STADIUM_FLAG_PIN` bit on the session's own patron header, so Stadium's own
internal eviction/admission logic (which must stay self-contained, no call back into
session.c) keeps seeing a correct bit. **Addition**: `Session` needed a `stadium_cell`
field (index into `stadium_cells()`) that wasn't in the original §H.2 field list — the
choke point can't reach the right patron header without it. Necessary plumbing, not a new
session-level concept, so not treated as reopening §H.2's design. Also moved
`STADIUM_FLAG_PIN`'s `#define` from a `stadium.c`-private constant to `stadium.h` (public)
so `session.c` can reference it without duplicating the definition. Verified 3-arch boot to
`ok>`.
4. Rewire `stadium_birth_hera()` to register through `session_register()`/
`session_set_pinned()` instead of setting `STADIUM_FLAG_PIN` directly — Hera becomes
session zero.