Files
StarForth/src/starkernel/vm
Robert Allan JamesandClaude Sonnet 5 378d688898 starkernel: item 3.3 -- behaviour enumeration and dispatch
Punch list §25 item 3.3 complete.

StadiumBehaviour (stadium.h) enumerates exactly the four tags §18.3
already names -- MIGRATE, DELIVER, EXPIRE, COOL -- mapped from §17.1's
patron table: blocks->MIGRATE, messages->DELIVER, ACLs->EXPIRE, words
and VMs both->COOL. Nothing invented; the tag set and mapping were
already in the document.

stadium_dispatch(cell_index, behaviour) dispatches on the tag only,
never asks what kind of patron departed. Handlers are stubs -- the
real actions belong to subsystems not yet migrated onto the Stadium
(Phase 4). Nothing calls stadium_dispatch() yet; item 3.5 is its first
consumer.

The switch is exhaustive with no default case, making §13's "closed
enumeration, fixed at build time" a compiler-enforced property under
this project's -Wall -Werror rather than just prose. Verified live:
temporarily deleted the COOL case, rebuild failed with
error: enumeration value 'STADIUM_BEHAVIOUR_COOL' not handled in
switch [-Werror=switch], restored it, confirmed clean again.

The header's behaviour field stays uint8_t, not the enum type itself,
since C does not guarantee an enum's underlying type and that field's
offset is load-bearing for item 3.1's validated 64-byte layout.

Verified: three-architecture boot (amd64, aarch64, riscv64), all
reaching ok> with identical dict_hash=0x3d4e1daf289da94f matching the
item-3.2 baseline.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-04 17:06:14 -04:00
..
2026-08-01 07:49:56 -04:00

src/starkernel/vm/

Kernel-side StarForth VM subsystem.

  • vm_core.c — kernel port of the core interpreter loop.
  • vm_runtime.c — kernel VM runtime support.
  • vm_bootstrap.c — kernel VM bootstrap (distinct from bootstrap/sk_vm_bootstrap.c, which owns the higher-level subsystem wiring called from kernel_main.c).
  • arena.c — capsule arena allocator (fixed-region allocation for capsule payload data).
  • parity.c — birth/execution parity logging (VM ID + capsule hash + dictionary hash), enabling offline determinism verification.
  • alloc_kernel.c — the kernel-side implementation of the VM's allocator interface actually referenced by Makefile.starkernel's build (see src/platform/README.md for a note on a second, unwired copy).
  • q48_stubs.c — deliberate no-op stubs for q48_from_double()/ q48_to_double() in the freestanding kernel build, where floating point is unavailable; always returns zero, safe because shared VM code only uses these results for logging/diagnostic paths that are inactive in the kernel build.
  • vm_internal.h — internal-only declarations shared across this directory's files.

Subdirectories:

  • bootstrap/sk_vm_bootstrap.c — owns VM init + capsule loading wiring, called from kernel_main.c; kernel_main.c itself only owns hardware milestones.
  • host/shim.c — host-service shim bridging the kernel VM to src/starkernel/hal/host_services.c.