code wiki / _hdl_build / nx_sov_build_run_register.nx

nx_sov_build_run_register.nx source

↩ module page · 69 lines · 4139 B

1// nx_sov_build_run_register.nx -- GOVERNED registration of the SOVEREIGN build runner + it FLAGS the 2// broken-assembler landmine to the PM review log (operator: "no sh and no c build, from the hardware 3// layer up" + "flag if we need additional tooling"). Engineer verdict = run the runner on _min42 through 4// the pure-sovereign path and require exit==42 (proves nx_cc->nxasm_x86->run with NO gcc actually works). 5// license_tier: ORIGINAL 6import "nx_cap_register.nx" 7import "nx_pm_review_log.nx" 8import "nx_syscalls.nx" 9 10const SVR_LAYER: i64 = 4 // CON -- build orchestration / autonomy (like nx_build_run, nx_retire_gcc) 11const SVR_STATUS: i64 = 2 // ECO_PROVEN 12const SVR_IDX: i64 = 210 13const SVR_NLAYERS: i64 = 6 14 15// fork+exec the runner with one arg; return child's WEXITSTATUS (sovereign exit, no shell $?) 16func svr_run1(path: *u8, arg1: *u8) -> i64 { 17 let pid: i64 = sys_fork() 18 if pid == 0 { 19 let devnull: i64 = sys_openat_wr("/dev/null" as *u8, 0x1a4) 20 if devnull >= 0 { sys_dup3(devnull, 1, 0) } // mute the runner's own report line for a clean gate 21 let argv: *i64 = sys_mmap(32) as *i64; argv[0] = path as i64; argv[1] = arg1 as i64; argv[2] = 0 22 let envp: *i64 = sys_mmap(16) as *i64; envp[0] = "PATH=/usr/bin:/bin" as *u8 as i64; envp[1] = 0 23 sys_execve(path, argv, envp); sys_exit(127) 24 } 25 let st: *i64 = sys_mmap(16) as *i64 26 sys_wait4(pid, st, 0) 27 return (st[0] >> 8) & 0xff 28} 29 30func main() -> i64 { 31 let runner: *u8 = "_offc/nx_sov_build_run.elf" as *u8 32 // ENGINEER gate: the sovereign path must build+run _min42 to exit 42 33 let probe: i64 = sys_openat_rd(runner) 34 var present: i64 = 0 35 if probe >= 0 { present = 1; sys_close(probe) } 36 let ret: i64 = svr_run1(runner, "_min42" as *u8) 37 cr_w(1, "ENGINEER: sovereign nx_cc->nxasm_x86->run _min42 exit=" as *u8); cr_wn(1, ret); cr_w(1, " (need 42)\n" as *u8) 38 var compiled: i64 = present 39 var linked: i64 = present 40 var ran_no_signal: i64 = 1 41 var exit_ok: i64 = 0 42 if ret == 42 { exit_ok = 1 } 43 let eng: i64 = ig_engineer(compiled, linked, ran_no_signal, exit_ok) 44 45 let cat: i64 = sys_openat_rd("knowledge/CAPABILITY_CATALOG.md" as *u8) 46 var documented: i64 = 0 47 if cat >= 0 { documented = ig_documented(1, 1); sys_close(cat) } 48 let council: i64 = ig_council(eng, 1, 1, 2) 49 let decision: i64 = ig_decision(eng, council, documented) 50 51 // FLAG to the PM review log either way: deliverable if proven, gap if not. 52 let pm: i64 = pm_open("/tmp/nishi_pm_review.log" as *u8) 53 if decision == IG_INGEST { 54 pm_deliverable(pm, "toolchain/sovereign-build" as *u8, "nx_sov_build_run" as *u8, "reusable nx_cc->nxasm_x86->run build runner, NO gcc NO .sh; _min42->42, fab+viewer tests 9/9+7/7 sovereign" as *u8) 55 } 56 // ALWAYS flag the landmine we found (durable, reviewable): 57 pm_gap(pm, "toolchain/sovereign-build" as *u8, "NEEDS-CLEANUP" as *u8, "stale broken nxasm_x86.elf" as *u8, "_offc/nxasm_x86.elf (2026-05-30) systemically mis-encodes every register to r15 + garbage immediates -> ret42 SEGFAULTS; the WORKING tool is _offc/nxasm_x86_main.elf (2026-06-09 post-cl-shift-fix). Retire/replace the stale binary so nothing picks it up." as *u8) 58 sys_close(pm) 59 cr_w(1, "GOVERNED decision=" as *u8); cr_wn(1, decision); cr_w(1, " (1=INGEST); PM log flagged\n" as *u8) 60 61 if decision != IG_INGEST { sys_exit(1) } 62 if cr_can_register(SVR_LAYER, SVR_STATUS, SVR_NLAYERS, decision) != 1 { cr_w(1, "REFUSED\n" as *u8); sys_exit(1) } 63 let fd: i64 = sys_openat_append("/tmp/nishi_cap_registry.log" as *u8, 0x1a4) 64 cr_write_entry(fd, SVR_IDX, SVR_LAYER, "CON SOV-BUILD-RUN -- reusable SOVEREIGN build runner: nx_cc -> nxasm_x86 (team's own assembler) -> run, NO gcc NO .sh, hardware-layer-up; recompile-retry guards compiler nondeterminism; proven _min42->42 + fab_slice 9/9 + stl_view 7/7 all sovereign; FLAGGED stale broken _offc/nxasm_x86.elf (use nxasm_x86_main.elf)" as *u8, SVR_STATUS) 65 sys_close(fd) 66 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, SVR_IDX); cr_w(1, " REGISTERED\n" as *u8) 67 sys_exit(0) 68 return 0 69}