feat(v4): the mesh boot to spec -- Hera born empty in the kernel's fabric; births, kills, every node stepping together (#189)
ENGINE step 4 Phase 1, Tasks 5b-5d, and the edge cases (Captain Bob, 2026-11-13: "Build it to proper spec"; "Check for the edge cases"; "Yes, add it to v4-checks"). - v4/system/mesh.c, v4/include/v4/mesh.h: the nucleus assembled by the ROM and given to Hera as F18 cells; Hera born empty at place 0, the kernel on port 0, the console on port 1; told she is 10, in the registry, the kernel's words, FORTH-79, sealed, POST, the kernel's capsules. NODE-BORN / NODE-KILL in the owner's room. - No scheduler: v4_mesh_tell returns once the node told says how its text ended, and v4_mesh_step / v4_mesh_busy let the host step the fabric while it waits, so nodes run between lines as during them. A text left "waiting" is owed its end: the next line ends it "Interrupted" and is then run (MESH.md 7b.6). - kernel: sk_v4.c boots through the mesh; its idle steps the fabric while a node can run, and halts only when none can (#151 kept). stadium_return_quota and stadium_ops_forget on a kill. - Tests: v4/tests/test_mesh_boot.c (32 checks: the boot, births, kills, rebirth, a live number, a fault, no such node, Hera not killing herself, no room, a line too long, a node running for ever, a wait broken by the next line), run by `make -C v4 test` and under ASan+UBSan by `sanitize` (v4-checks); kernel/tests quota return; scripts/qemu_session.py births() and the edges on bare metal. - Docs: ENGINE.md 6 "who runs next" struck (settled: no scheduler); the Phase 1 plan; FABRIC-3 XLVIII.23; .claude/memory/rules.md: alpha.5 closed to new work. - Evidence: v4-checks 80 programs under the sanitizers, 0 failures; the hosted builds alike; two stopped v4-checks runs labelled STOPPED; three development amd64 boots labelled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
+34
-3
@@ -29,7 +29,9 @@ CFLAGS ?= $(CSTD) $(WARN) $(OPT)
|
||||
HERE := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
|
||||
|
||||
SRCS := $(wildcard $(HERE)/src/*.c)
|
||||
TESTS := $(wildcard $(HERE)/tests/test_*.c)
|
||||
# test_mesh_boot.c is the kernel's boot of the fabric, linked as the hosted product is (its own rule,
|
||||
# `mesh-boot`, below), not one of the per-width tests.
|
||||
TESTS := $(filter-out %/test_mesh_boot.c,$(wildcard $(HERE)/tests/test_*.c))
|
||||
|
||||
# Cell widths to build and verify. 32 is the F18/Zynq case, 64 the aarch64
|
||||
# host case; see DECOMPOSITION.md D-5.
|
||||
@@ -344,12 +346,41 @@ $(foreach w,$(WIDTHS),$(foreach t,$(TESTS),$(eval $(call TEST_RULE,$(w),$(t)))))
|
||||
$(foreach w,$(WIDTHS),$(foreach t,$(TESTS),$(eval $(call RUN_RULE,$(w),$(t)))))
|
||||
$(foreach w,$(WIDTHS),$(foreach t,$(TESTS),$(eval $(call SAN_RULE,$(w),$(t)))))
|
||||
|
||||
sanitize: $(foreach w,$(WIDTHS),$(foreach t,$(TESTS),san-$(w)-$(notdir $(t))))
|
||||
sanitize: $(foreach w,$(WIDTHS),$(foreach t,$(TESTS),san-$(w)-$(notdir $(t)))) san-mesh-boot
|
||||
@echo "all v4 tests passed under ASan+UBSan"
|
||||
|
||||
.PHONY: $(foreach w,$(WIDTHS),$(foreach t,$(TESTS),run-$(w)-$(notdir $(t)) san-$(w)-$(notdir $(t))))
|
||||
|
||||
test: $(addprefix test-,$(WIDTHS))
|
||||
# THE MESH BOOT (system/mesh.c; #189, ENGINE step 4 Phase 1, Task 5b): the kernel's boot of the
|
||||
# fabric, tested on the host with tests/test_mesh_boot.c as its owner. Linked as the hosted product
|
||||
# is, with the registry (src/manage.c) and a mesh node's ROM; 64-bit cells, as the capsules are.
|
||||
MESH_BOOT_SRCS := $(HERE)/system/mesh.c $(HERE)/src/manage.c $(BINDIR)/mesh-rom-64.c
|
||||
$(BINDIR)/test_mesh_boot: $(HERE)/tests/test_mesh_boot.c $(MESH_BOOT_SRCS) $(MACHINE_64) $(CAPSULE_DIR_C) $(ENGINE_SRCS) $(SYSTEM_SRCS) $(BLOCKS_SRC) $(V3_BLOCK_SRCS) $(wildcard $(HERE)/include/v4/*.h) $(HERE)/Makefile
|
||||
$(CC) $(CFLAGS) -D_POSIX_C_SOURCE=200809L -I$(HERE)/include $(V3_INC) -DV4_CELL_BITS=64 $(HOST_DEFS) -c $(HERE)/tests/test_mesh_boot.c -o $(BINDIR)/test_mesh_boot.o
|
||||
$(CC) $(SYSTEM_CFLAGS) -c $(HERE)/system/mesh.c -o $(BINDIR)/mesh-64.o
|
||||
@rm -rf $(BINDIR)/v3o-mesh && mkdir -p $(BINDIR)/v3o-mesh
|
||||
cd $(BINDIR)/v3o-mesh && $(CC) $(V3_CFLAGS) -I$(HERE)/include -DV4_CELL_BITS=64 $(HOST_DEFS) -c $(V3_BLOCK_SRCS) $(BLOCKS_SRC)
|
||||
$(CC) $(SYSTEM_CFLAGS) $(BINDIR)/test_mesh_boot.o $(BINDIR)/mesh-64.o $(HERE)/src/manage.c $(BINDIR)/mesh-rom-64.c $(MACHINE_64) $(CAPSULE_DIR_C) $(ENGINE_SRCS) $(SYSTEM_SRCS) $(BINDIR)/v3o-mesh/*.o -o $@
|
||||
|
||||
.PHONY: mesh-boot
|
||||
mesh-boot: $(BINDIR)/test_mesh_boot
|
||||
@echo " [mesh boot, V4_CELL_BITS=64]"
|
||||
@$(BINDIR)/test_mesh_boot
|
||||
|
||||
# The same, under ASan+UBSan (Captain Bob, 2026-11-13: "Yes, add it to v4-checks"): run by `sanitize`.
|
||||
MESH_SAN := -O1 -g -fno-omit-frame-pointer -fsanitize=address,undefined -fno-sanitize-recover=all
|
||||
$(BINDIR)/san-test_mesh_boot: $(BINDIR)/test_mesh_boot
|
||||
$(CC) $(CFLAGS) $(MESH_SAN) -D_POSIX_C_SOURCE=200809L -I$(HERE)/include $(V3_INC) -DV4_CELL_BITS=64 $(HOST_DEFS) -c $(HERE)/tests/test_mesh_boot.c -o $(BINDIR)/san-test_mesh_boot.o
|
||||
@rm -rf $(BINDIR)/san-v3o-mesh && mkdir -p $(BINDIR)/san-v3o-mesh
|
||||
cd $(BINDIR)/san-v3o-mesh && $(CC) $(V3_CFLAGS) $(MESH_SAN) -I$(HERE)/include -DV4_CELL_BITS=64 $(HOST_DEFS) -c $(V3_BLOCK_SRCS) $(BLOCKS_SRC)
|
||||
$(CC) $(SYSTEM_CFLAGS) $(MESH_SAN) $(BINDIR)/san-test_mesh_boot.o $(HERE)/system/mesh.c $(HERE)/src/manage.c $(BINDIR)/mesh-rom-64.c $(MACHINE_64) $(CAPSULE_DIR_C) $(ENGINE_SRCS) $(SYSTEM_SRCS) $(BINDIR)/san-v3o-mesh/*.o -o $@
|
||||
|
||||
.PHONY: san-mesh-boot
|
||||
san-mesh-boot: $(BINDIR)/san-test_mesh_boot
|
||||
@echo " [ASan+UBSan mesh boot, V4_CELL_BITS=64]"
|
||||
@$(BINDIR)/san-test_mesh_boot
|
||||
|
||||
test: $(addprefix test-,$(WIDTHS)) mesh-boot
|
||||
@echo "all v4 tests passed"
|
||||
|
||||
clean:
|
||||
|
||||
Reference in New Issue
Block a user