blk_subsys_detach_device() (block_subsystem.c) walks the device chain, refuses removal of anything but the current tail (a mid-chain removal would corrupt every later slot's start_lbn -- this architecture's own doc already argues USB stays last specifically to avoid that), unlinks, shrinks total_user_lbn, closes and frees the slot. Discards rather than flushes dirty state -- the device is physically gone by the time this runs (PORTSC disconnect only). Trigger wiring mirrors the attach path: bot_msc_attached (set only once attach actually succeeds) gates a new bot_msc_detach_pending flag set at PORTSC disconnect (not Disable Slot completion, which is conditionally skipped and would miss concurrent connect/disconnect pairs), consumed in sk_repl_idle(). Advisor flagged the real hazard ahead of time: block_words.c's VM block window (blk_vm_lbn[]/blk_vm_cbuf[]) can go stale across a detach then a same-LBN re-attach, and suggested a pointer-identity re-check in blk_vm_load() as a minimal fix. That fix was implemented, then directly falsified by its own designed-for-this test: attach a blank device, read a block (populating the cache), detach, re-attach a device with distinct content at the identical LBN, read again -- served stale content from the first device. Root cause, confirmed live: glibc's allocator hands free(slot) straight back to the very next same-size calloc(), so the "fresh" and stale pointers were bitwise identical despite being two different devices. Fixed properly with a monotonic blk_subsys_epoch() counter (bumped on every attach/detach) checked by a new blk_vm_check_epoch() helper at the one choke point (blk_vm_find(), plus blk_vm_flush_all() which reads the same arrays directly) that covers every path touching the window cache -- unfooled by address reuse. Verified live with a new disk/usb-thumbdrive-test2.img fixture (distinct content from the existing blank test image): attach A, read (cache hit populated), detach, re-attach B at the same LBN, read again -- correctly ran a fresh device read and returned B's real content, not A's stale cached zeros. The failing pointer-comparison attempt's own capture log kept as evidence, not deleted. All three architectures re-verified clean. FABRIC-2.md Section X 2h marked complete -- enumeration through hot-detach all live and verified; only WRITE(10) (2g's own still-open item) remains unimplemented in the driver, not blocking anything here. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CXjAPTEKrgY2Mrk25KoLDn
src/word_source/
FORTH-79 word implementations, one file per category, registered into the
dictionary via include/word_registry.h. Each .c file here has a
matching header in src/word_source/include/ and (for most categories) a
matching test module in src/test_runner/modules/.
FORTH-79 core
arithmetic_words.c,mixed_arithmetic_words.c—+ - * / MOD ABS MIN MAXand mixed-precision arithmetic.stack_words.c—DUP DROP SWAP ROT OVER NIP TUCK.control_words.c—IF ELSE THEN DO LOOP BEGIN UNTIL WHILE.defining_words.c—: ; CREATE DOES> VARIABLE CONSTANT.memory_words.c—@ ! C@ C! MOVE FILL.return_stack_words.c—>R R> R@ RDROP 2>R 2R@ 2R>.double_words.c—2DUP 2DROP 2SWAP 2@ 2! D+ D-.logical_words.c—AND OR XOR NOT INVERT LSHIFT RSHIFT.io_words.c—EMIT KEY TYPE CR TAB SPACE ACCEPT.string_words.c—S" SLITERALand other string operations.block_words.c—BLOCK BUFFER LOAD THRU FLUSH.format_words.c—.( .R .S HEX DECIMAL BASE.system_words.c—BYE ABORT INCLUDE STATE.dictionary_words.c—FIND SEARCH-WORDLIST WORDS.dictionary_manipulation_words.c— dictionary entry manipulation words.vocabulary_words.c—VOCABULARY DEFINITIONS FORTH-WORDLIST.editor_words.c— block editor words.defer_words.c—DEFER/ISdeferred-word mechanism, used by the Tripod message-dispatch shim (seetools/hermes_tripod_smoke.sh).
StarForth-specific extensions
q48_16_words.c,q48_words.c— Q48.16 fixed-point word bindings.starforth_words.c— StarForth-specific extensions.acl_words.c— word-level ACL system's FORTH-callable primitives (seedocs/03-architecture/word-acl/).lifecycle_words_hosted.c— hosted-build VM lifecycle words (birth/run primitives on the hosted side; kernel-only primitives live insrc/starkernel/capsule/mama_forth_words.c).log_words.c— FORTH-callable logging primitives.inference_words.c— FORTH-callable bindings for the statistical inference engine (Loops #5/#6).physics_benchmark_words.c— benchmark harness for the 7 physics feedback loops.physics_diagnostic_words.c— physics diagnostics (WORD-ENTROPY).physics_freeze_words.c—PHYSICS-FREEZE/PHYSICS-THAW.physics_pipelining_diagnostic_words.c— Loop #4 pipelining diagnostics.dictionary_heat_diagnostic_words.c— Loop #1 heat diagnostics.
See src/word_source/include/ for the matching headers (also includes
mama_forth_words.h, whose .c implementation lives under
src/starkernel/capsule/ since it's kernel-only).