Rename FABRIC series: FABRIC.md->0, FABRIC-2.md->1, FABRIC-3.md->2, FABRIC-4.md unchanged

FABRIC.md -> FABRIC-0.md
FABRIC-2.md -> FABRIC-1.md
FABRIC-3.md -> FABRIC-2.md (the current/living document)
FABRIC-4.md unchanged (new #3 to follow separately)

Every cross-reference repo-wide updated to match, including doc-comment
citations inside kernel source (.c/.h) files -- done via an ordered
placeholder substitution (FABRIC-3.md->placeholder2, FABRIC-2.md->
placeholder1, FABRIC.md->placeholder0, then placeholders resolved to
final names) in a single pass per file to avoid double-shifting
already-renamed references.

One line in capsules/font.4th grew past the 64-char block-format limit
as a side effect of the longer filename; shortened it and reverified
with mkcapsule --lint (34/34 pass) before rebuilding.

Verified 3-arch boot to ok> (amd64/aarch64/riscv64, each in the
foreground) after the fix; logs and DoE CSVs from this session's
verification runs included per this repo's own audit-artifact
convention.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019YcT3H2PQeyujrzjqS3Var
This commit is contained in:
Robert Allan James
2026-09-04 11:22:51 -04:00
co-authored by Claude Sonnet 5
parent ff2941dfb9
commit b031b802e3
128 changed files with 37154 additions and 9572 deletions
+32 -32
View File
@@ -18,7 +18,7 @@
* Idle spin: polls console_getc() and services the adaptive heartbeat.
* The timer ISR's top half (heartbeat_tick()) latches one
* sample per interrupt; the idle spin drains it every
* iteration via heartbeat_service() (item 0.8, FABRIC.md §26)
* iteration via heartbeat_service() (item 0.8, FABRIC-0.md §26)
* and calls sk_repl_idle() once per SK_IDLE_BEAT_INTERVAL ticks
* for coarser subsystem dispatch. On QEMU TCG the ISR must fire
* for ticks to advance — check "Heartbeat: N ticks" in the
@@ -49,7 +49,7 @@
#include <stdint.h>
#include <string.h>
/* FABRIC.md 4.4: "ok>" (including its trailing space) renders in bright
/* FABRIC-0.md 4.4: "ok>" (including its trailing space) renders in bright
* cyan, 0x55FFFF -- reuses FB_ANSI_PALETTE[14]. Sent as a real SGR escape
* so it colors both the framebuffer (parsed by vt100.c's apply_sgr()) and
* any ANSI-aware serial terminal, per 4.4c's "identical on both" goal. */
@@ -57,7 +57,7 @@
const char lithos_version[64] = LITHOS_VERSION_STR;
/* FABRIC.md §27.8/4.4s, unblocked 2026-09-04: extends the prompt to
/* FABRIC-0.md §27.8/4.4s, unblocked 2026-09-04: extends the prompt to
* "[VM name] (user) ok>" (e.g. "[Hera] (zuse) ok>") whenever an
* identity is currently attached -- Zuse (mama_vm->zuse_session; there
* is only ever one, so no username lookup needed) or a regular WIREBIND
@@ -67,7 +67,7 @@ const char lithos_version[64] = LITHOS_VERSION_STR;
* segment reflects "who is at the console" the same way regardless of
* which VM you've USE'd into. Prints nothing (bare "ok> ", today's
* existing format, unchanged) when neither is attached -- Hera's own
* documented normal steady state (FABRIC-3.md §D.2). */
* documented normal steady state (FABRIC-2.md §D.2). */
static void sk_print_prompt(void) {
VM *mama_vm = (VM *)sk_get_mama_vm();
const char *username;
@@ -97,7 +97,7 @@ VM *sk_repl_get_active_vm(void) { return g_repl_active_vm; }
/*===========================================================================
* Currently attached home-blocks device: mirrors g_repl_active_vm's own
* shape (FABRIC-3.md §F.9's own precedent for this exact accessor). Set
* shape (FABRIC-2.md §F.9's own precedent for this exact accessor). Set
* once sk_repl_idle()'s own attach handling confirms HOMEBLOCKS_SIG_OK
* below; cleared on detach. RUNCAP (§F.6/§F.18) and, later, BINDSTEP's
* re-verify-live check (§F.9) both need this -- neither lives in this
@@ -146,7 +146,7 @@ static uint64_t g_last_beat_tick; /* zero-initialized (BSS) */
/* Reentrancy guards for the MSG-TICK pump inside sk_repl_idle().
*
* sk_repl_idle() runs vm_interpret(mama, ...) (below) to VM-EXEC MSG-TICK
* into every live child VM (FABRIC-3.md Phase C). But sk_repl_idle() is
* into every live child VM (FABRIC-2.md Phase C). But sk_repl_idle() is
* itself called from the blocking KEY/EXPECT/QUERY reads (sk_console_getkey()
* / sk_console_readline(), which run *from inside* the executing VM's own
* vm_interpret once a FORTH word reads input mid-line). vm_interpret() is
@@ -204,7 +204,7 @@ static void sk_repl_idle(VM *active_vm)
int rc = blkio_usb_open_msc(&usb_blk_dev, xdev, slot_id);
if (rc == 0) {
/* FABRIC-3.md Milestone 4: warn on blank/foreign/unrecognized
/* FABRIC-2.md Milestone 4: warn on blank/foreign/unrecognized
* media -- the "warn" half. No "refuse" half yet: blkio_usb.c
* has no SCSI WRITE(10) support at all (Milestone 2's biggest
* open item), so there is no write path today to refuse --
@@ -218,7 +218,7 @@ static void sk_repl_idle(VM *active_vm)
*
* HOMEBLOCKS_SIG_START_FBLOCK (devblock 1): the real, final
* location -- GPT was dropped permanently, this is not an
* interim value (FABRIC-3.md §F.8/§F.13). */
* interim value (FABRIC-2.md §F.8/§F.13). */
homeblocks_sig_t sig;
homeblocks_sig_result_t sig_rc =
homeblocks_sig_check(&usb_blk_dev, HOMEBLOCKS_SIG_START_FBLOCK, &sig);
@@ -243,7 +243,7 @@ static void sk_repl_idle(VM *active_vm)
break;
}
/* FABRIC-3.md §F.20/§F.21: Zuse is thumbdrive-resident now,
/* FABRIC-2.md §F.20/§F.21: Zuse is thumbdrive-resident now,
* not system-resident -- this is the only point in the boot
* lifecycle a just-attached drive's sig result is known, so
* genesis-mint/attach-authenticate has to happen from here,
@@ -253,7 +253,7 @@ static void sk_repl_idle(VM *active_vm)
* identity this boot. */
capsule_zuse_boot_try_attach(&usb_blk_dev, sig_rc, &sig, (VM *)sk_get_mama_vm());
/* FABRIC-3.md §F.5/§F.23 (WIREBIND): the real thumbdrive-
/* FABRIC-2.md §F.5/§F.23 (WIREBIND): the real thumbdrive-
* attach call site for a regular (non-Zuse) identity --
* verify-then-birth-then-pair, replacing the RUNCAP-TEST/
* PAIR-TEST diagnostic words that exercised each piece by
@@ -291,19 +291,19 @@ static void sk_repl_idle(VM *active_vm)
g_attached_blk_dev = (void *)0;
}
/* FABRIC-3.md §F.10 decision 2 (UNCLEAN, closed alongside EJECT):
/* FABRIC-2.md §F.10 decision 2 (UNCLEAN, closed alongside EJECT):
* the device is already gone -- no-op if WIREBIND never had
* anything tracked (general-purpose USB use, not a home-blocks
* identity drive). */
capsule_wirebind_unclean_detach();
/* FABRIC-3.md §I.8, re-scoped 2026-09-04: Zuse logs out on device
/* FABRIC-2.md §I.8, re-scoped 2026-09-04: Zuse logs out on device
* removal exactly like a WIREBIND user -- no-op if the device
* that just left wasn't hers. */
capsule_zuse_boot_logout((VM *)sk_get_mama_vm());
}
/* FABRIC.md/FABRIC-2.md Section V item 6: "a cheap 'anything dirty?
/* FABRIC-0.md/FABRIC-1.md Section V item 6: "a cheap 'anything dirty?
* no? done' block-sync check", the same "interrupt-driven, coarse
* cadence, cheap early-exit" trigger shape as the xHCI servicing
* above -- this was the one piece of that design already fully
@@ -325,7 +325,7 @@ static void sk_repl_idle(VM *active_vm)
* did not survive a reboot until this fix. */
blk_vm_flush_all(active_vm);
/* FABRIC-3.md §I.2, built 2026-09-04: heat/wear-leveling migration
/* FABRIC-2.md §I.2, built 2026-09-04: heat/wear-leveling migration
* trigger -- one linear scan of Artemis's own device per idle tick
* (same ~1 Hz SK_IDLE_BEAT_INTERVAL cadence this whole function
* already runs at, chosen so a hot devblock is caught proactively
@@ -335,7 +335,7 @@ static void sk_repl_idle(VM *active_vm)
* migration, needs a call site threaded from WIREBIND). */
blk_migration_idle_check();
/* FABRIC-3.md Phase C (2026-08-28): distributed messaging pump. Every
/* FABRIC-2.md Phase C (2026-08-28): distributed messaging pump. Every
* live VM except Hera herself now owns its own MSG-ARENA/CH-ARENA and
* MSG-TICK word (see capsules/common/messaging.4th) instead of only
* Hermes having one -- "fully distributed, Hera pumps each VM's
@@ -388,7 +388,7 @@ static void sk_repl_idle(VM *active_vm)
}
/*===========================================================================
* FABRIC.md item 4.4v: keyboard-to-REPL bridge.
* FABRIC-0.md item 4.4v: keyboard-to-REPL bridge.
*
* Translates sk_key_event_poll()'s converged Linux-keycode-namespace
* stream (keyboard_words.c -- one implementation shared with KEY-EVENT,
@@ -492,7 +492,7 @@ static int sk_kbd_getc(void)
static int sk_console_getc_raw(void)
{
int c = console_getc();
if (c < 0) c = sk_kbd_getc(); /* FABRIC.md 4.4v: second source, same buffer */
if (c < 0) c = sk_kbd_getc(); /* FABRIC-0.md 4.4v: second source, same buffer */
return c;
}
@@ -585,7 +585,7 @@ int sk_console_readline(char* buf, int size, VM* active_vm, int reanchor_prompt)
if (c < 0) {
/* Service the heartbeat bottom half every idle iteration, not
* gated by SK_IDLE_BEAT_INTERVAL (item 0.8, FABRIC.md §26):
* gated by SK_IDLE_BEAT_INTERVAL (item 0.8, FABRIC-0.md §26):
* heartbeat_service() drains at most one latched sample per
* call, so a coarse gate here would silently lose or merge
* samples between ISR-latched ticks. sk_repl_idle() below is
@@ -612,14 +612,14 @@ int sk_console_readline(char* buf, int size, VM* active_vm, int reanchor_prompt)
}
/*
* Re-anchor the prompt (FABRIC.md 4.4a unified prompt: print
* Re-anchor the prompt (FABRIC-0.md 4.4a unified prompt: print
* only "ok> " here -- console_putc() auto-prefixes the current
* [VMName] on a fresh line). When an idle bottom half above
* pushed output past prompt_tx_mark, the console cursor is now
* below/after new lines and the "ok> " the caller printed has
* been scrolled or buried -- once the flood passes, the screen
* and serial log would end on a stale line with no prompt
* (FABRIC-3.md: the bare prompt must be the last thing shown
* (FABRIC-2.md: the bare prompt must be the last thing shown
* while the REPL sits idle). Reprinting it restores that
* invariant. Skipped while a line is being edited (n > 0) so
* partial echo stays attached to its own prompt; shim.c's
@@ -683,7 +683,7 @@ int sk_console_readline(char* buf, int size, VM* active_vm, int reanchor_prompt)
/*===========================================================================
* sk_repl - FORTH REPL
*
* FABRIC-3.md §F.20/§F.21 (2026-08-28): the unauthenticated emergency-CLI
* FABRIC-2.md §F.20/§F.21 (2026-08-28): the unauthenticated emergency-CLI
* ACL bypass this REPL used to grant itself on Hera's own bare prompt is
* retired -- every word runs under ordinary ACL enforcement here now,
* console identity included. emergency_console still exists as a field
@@ -707,7 +707,7 @@ static void sk_fault_handler(VM *vm) {
#endif
/*===========================================================================
* sk_repl_dispatch_line - console-VM + user-VM pair relay (FABRIC-3.md
* sk_repl_dispatch_line - console-VM + user-VM pair relay (FABRIC-2.md
* Phase F, 2026-08-28).
*
* If `vm`'s own registered name has a live "<name>~user" counterpart,
@@ -727,7 +727,7 @@ static void sk_fault_handler(VM *vm) {
* v1 limitation -- warned about, not silently mishandled).
*===========================================================================*/
/* USE (FABRIC-3.md §F.24) is a REPL-control word, not a command for
/* USE (FABRIC-2.md §F.24) is a REPL-control word, not a command for
* whatever VM happens to be paired to a console -- it must always run
* on the active VM directly, never get relayed as a message. Real
* FORTH syntax always puts USE last (S" name" USE), so a trailing-
@@ -809,20 +809,20 @@ out:
int sk_repl_step(VM *vm)
{
char input[INPUT_BUFFER_SIZE]; /* FABRIC.md 4.4w: matches the strip's input width */
char input[INPUT_BUFFER_SIZE]; /* FABRIC-0.md 4.4w: matches the strip's input width */
if (!vm || vm->halted) return 0;
{
/* Unified prompt (FABRIC.md 4.4a): console_putc()'s existing per-line
/* Unified prompt (FABRIC-0.md 4.4a): console_putc()'s existing per-line
* "[VMName] " prefix (console.c, g_active_vm_name) already supplies the
* bracket -- print only "ok> " here, don't build a second one.
* emergency_console is no longer set from here (FABRIC-3.md §F.20/
* emergency_console is no longer set from here (FABRIC-2.md §F.20/
* §F.21: the emergency-CLI ACL bypass is retired) -- it's driven
* only by the genuine C-level fault handler now (vm.c's own
* emergency-fault-recovery use, EMERGENCY_CONSOLE_ENABLED). Every
* word run from this REPL, Hera's bare prompt included, goes
* through ordinary ACL enforcement. FABRIC.md 4.4s (2026-09-04):
* through ordinary ACL enforcement. FABRIC-0.md 4.4s (2026-09-04):
* sk_print_prompt() extends this with a "(user)" segment when an
* identity is attached -- see its own doc comment. */
sk_print_prompt();
@@ -854,7 +854,7 @@ int sk_repl_step(VM *vm)
void sk_repl_run(VM *vm)
{
char input[INPUT_BUFFER_SIZE]; /* FABRIC.md 4.4w: matches the strip's input width */
char input[INPUT_BUFFER_SIZE]; /* FABRIC-0.md 4.4w: matches the strip's input width */
VM *active;
vm->halted = 0;
@@ -863,12 +863,12 @@ void sk_repl_run(VM *vm)
/* USE may redirect input to a different VM each iteration */
active = g_repl_active_vm ? g_repl_active_vm : vm;
/* Unified prompt (FABRIC.md 4.4a): console_putc()'s existing per-line
/* Unified prompt (FABRIC-0.md 4.4a): console_putc()'s existing per-line
* "[VMName] " prefix (console.c, g_active_vm_name) already supplies the
* bracket -- print only "ok> " here, don't build a second one.
* emergency_console is no longer set from here (FABRIC-3.md §F.20/
* emergency_console is no longer set from here (FABRIC-2.md §F.20/
* §F.21: the emergency-CLI ACL bypass is retired) -- see sk_repl_
* step()'s matching comment above. FABRIC.md 4.4s (2026-09-04):
* step()'s matching comment above. FABRIC-0.md 4.4s (2026-09-04):
* sk_print_prompt() extends this with a "(user)" segment. */
sk_print_prompt();
@@ -897,7 +897,7 @@ void sk_repl_run(VM *vm)
void sk_repl(VM *vm)
{
/* FABRIC.md item 4.4j: boot and POST (both already returned by the time
/* FABRIC-0.md item 4.4j: boot and POST (both already returned by the time
* sk_repl() is called) stay on font_8x16.c/VT100 by design; the
* interactive REPL -- this function -- is the boundary where TTF-TEXT
* takes over. One-shot: console_fb_enable_ttf() no-ops on any later