code wiki / _hdl_build / nx_wasmemit_guard_gate.nx

nx_wasmemit_guard_gate.nx

buildroot/runtime/_hdl_build/nx_wasmemit_guard_gate.nx

9156 B206 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_wasmemit_guard_gate.nx -- EVERY ORGAN THAT EMITS A FRAMEBUFFER WASM PAGE MUST CALL THE FIT GUARD. WHY. /craft shipped BLACK twice because its framebuffer had outgrown the module's own declared linear memory. The guard that refuses that (nx_wasmfit's wf_guard) used to live inside nx_game_page_emit under a header claiming every wasm page in the estate was built through it. nx_wasmpage_census then measured all 62,906 shipped pages: 25 carry an embedded module and only 9 reach that function. ★★★★★★A GUARD PLACED IN "THE" SHARED PATH IS ONLY AS BROAD AS THE CLAIM THAT THE PATH IS SHARED, AND THAT CLAIM IS A MEASUREMENT NOBODY TOOK. The census is the after-the-fact audit -- it catches a bad page once it is already on disk. This is the BEFORE: a static check that every emitter is wired to the one ruler, so a new emitter cannot be written without the guard and pass unnoticed. ★A LAW I HAVE TO REMEMBER IS A LAW I WILL SKIP; PUT IT IN THE PATH. THE SUBJECT IS DEFINED BY A CONJUNCTION, NOT A GUESS. An organ is a framebuffer-page emitter iff its source carries all three literals of the blit shim it writes into the page: the instantiate call, and the ww/fb_off accessor reads. That matters because organs which merely MENTION wasm must not be swept in -- nx_sitegen_game_gate CHECKS emitted pages for "WebAssembly.instantiate" and would be a false positive on that literal alone. ★A DETECTOR WITH FALSE POSITIVES IS WORSE THAN NONE, and ★A SCANNER CANNOT TELL A CALL FROM A RENDERING OF A CALL -- so the rule is stated, narrow, and its misses are declared rather than hidden: an emitter that builds the shim string in pieces is NOT seen by this gate. That is a floor on coverage, printed as one. license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_wasmemit_guard_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

structs

none

consts

28const WG_M_INST: *u8 = "WebAssembly.instantiate"
29const WG_M_WW: *u8 = "ex.ww()"
30const WG_M_FBO: *u8 = "ex.fb_off()"
32const WG_M_GUARD: *u8 = "wf_guard("
40const WG_SELF: *u8 = "nx_wasmemit_guard_gate.nx"
42const WG_DIRBUF: i64 = 131072
43const WG_PATHBUF: i64 = 4096
44const WG_MAXDEPTH: i64 = 12
45const WG_ROOT: *u8 = "buildroot/runtime"
48const WG_TAL_SLOTS: i64 = 16

functions

50func wg_tal() -> *i64 { if WG_TAL == 0 { WG_TAL = sys_mmap(WG_TAL_SLOTS * 8) as i64 } return WG_TAL as *i64 }
52func wg_puts(s: *u8) -> i64 { return gv_puts(s) }
53func wg_num(v: i64) -> i64 { return gv_num(v) }
55func wg_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
57func wg_is_nx(nm: *u8) -> i64
66func wg_find(buf: *u8, len: i64, needle: *u8) -> i64
85func wg_lenbox() -> *i64 { if WG_LEN == 0 { WG_LEN = sys_mmap(16) as i64 } return WG_LEN as *i64 }
88func wg_ends_with(path: *u8, suf: *u8) -> i64
100func wg_check(path: *u8) -> i64
135func wg_walk(dir: *u8, depth: i64) -> i64
179func main(argc: i64, argv: *i64) -> i64