code wiki / _hdl_build / nx_wasmemit_guard_gate.nx
nx_wasmemit_guard_gate.nx
buildroot/runtime/_hdl_build/nx_wasmemit_guard_gate.nx
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
imports: nx_syscalls.nxnx_gate_verdict.nx
imported by: nobody (leaf or entry point)
structs
| none |
consts
| 28 | const WG_M_INST: *u8 = "WebAssembly.instantiate" |
| 29 | const WG_M_WW: *u8 = "ex.ww()" |
| 30 | const WG_M_FBO: *u8 = "ex.fb_off()" |
| 32 | const WG_M_GUARD: *u8 = "wf_guard(" |
| 40 | const WG_SELF: *u8 = "nx_wasmemit_guard_gate.nx" |
| 42 | const WG_DIRBUF: i64 = 131072 |
| 43 | const WG_PATHBUF: i64 = 4096 |
| 44 | const WG_MAXDEPTH: i64 = 12 |
| 45 | const WG_ROOT: *u8 = "buildroot/runtime" |
| 48 | const WG_TAL_SLOTS: i64 = 16 |
functions
| 50 | func wg_tal() -> *i64 { if WG_TAL == 0 { WG_TAL = sys_mmap(WG_TAL_SLOTS * 8) as i64 } return WG_TAL as *i64 } |
| 52 | func wg_puts(s: *u8) -> i64 { return gv_puts(s) } |
| 53 | func wg_num(v: i64) -> i64 { return gv_num(v) } |
| 55 | func wg_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 57 | func wg_is_nx(nm: *u8) -> i64 |
| 66 | func wg_find(buf: *u8, len: i64, needle: *u8) -> i64 |
| 85 | func wg_lenbox() -> *i64 { if WG_LEN == 0 { WG_LEN = sys_mmap(16) as i64 } return WG_LEN as *i64 } |
| 88 | func wg_ends_with(path: *u8, suf: *u8) -> i64 |
| 100 | func wg_check(path: *u8) -> i64 |
| 135 | func wg_walk(dir: *u8, depth: i64) -> i64 |
| 179 | func main(argc: i64, argv: *i64) -> i64 |