code wiki / _hdl_build / nx_nishios_kernel_gate.nx
nx_nishios_kernel_gate.nx
buildroot/runtime/_hdl_build/nx_nishios_kernel_gate.nx
about
nx_nishios_kernel_gate.nx -- the TRANSCRIPT gate for the composed NishiOS kernel boot.
WHY THIS EXISTS (a measured instrument defect, not a hypothetical): the BOOTSOV runner decides
its verdict from `halted && halt_code==0` ALONE -- it never reads the serial transcript. Proven
2026-07-31: a kernel image deliberately tampered so the Sv39 walk faults printed
"...TICK TX" instead of "...PAGE USER OK" and BOOTSOV still returned verdict=GREEN exit=0.
A runner that returns GREEN on a broken boot is not a check. This gate reads what the kernel
actually SAID and compares it to the table-computed golden transcript.
TEETH (each independently able to fail; the two NEG teeth are the non-vacuity proof):
T1 image present and not the 72-byte banner it replaced
T2 boots to a clean finisher halt
T3 transcript is EXACTLY the golden transcript
T4 every phase marker present (banner/trap/sched/timer/paging/user)
T5 NEG-comparator: the comparator must REJECT a mutated golden (proves it can say no)
T6 NEG-subject: a corrupted kernel image must NOT reproduce the golden transcript
T7 step count is far above the 17-step banner baseline (the boot does real work)
Sovereign: the emulator IS the runtime. license_tier: ORIGINAL
Boot-and-capture comes from the SHARED primitive, not a private copy: this gate, the census
and nx_kernel_adoption must agree byte-for-byte about what "booting the image" means, and three
hand-maintained copies is three chances for them to drift apart silently.
dependencies 1 imports · 0 importers
imports: nx_bootcap.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 24 | const NKG_BIN: *u8 = "runtime/_hdl_build/_boot_nishi_virt.bin" |
| 25 | const NKG_GOLD: *u8 = "runtime/_hdl_build/_boot_nishi_virt.bin.gold" |
| 26 | const NKG_BIN_ALT: *u8 = "_boot_nishi_virt.bin" |
| 27 | const NKG_GOLD_ALT: *u8 = "runtime/_hdl_build/_boot_nishi_virt.bin.gold" |
| 28 | const NKG_LOG: *u8 = "knowledge/status/boot_stub.log" |
| 30 | const NKG_MEM_BASE: i64 = 0x80000000 |
| 31 | const NKG_MEM_SIZE: i64 = 65536 |
| 32 | const NKG_TX_CAP: i64 = 4096 |
| 33 | const NKG_MAX_STEPS: i64 = 100000 |
| 34 | const NKG_BANNER_BYTES: i64 = 72 |
| 35 | const NKG_BANNER_STEPS: i64 = 17 |
functions
| 37 | func nkg_p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 38 | func nkg_fp(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 } called by 1: main |
| 39 | func nkg_fn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(fd,bb,k); return 0 } called by 1: main |
| 44 | func nkg_run(img: *u8, ilen: i64, tx_buf: *u8, res: *i64) -> i64 |
| 49 | func nkg_eq(a: *u8, an: i64, b: *u8, bn: i64) -> i64 called by 1: main |
| 56 | func nkg_has(hay: *u8, hn: i64, needle: *u8) -> i64 called by 1: main |
| 72 | func nkg_tooth(name: *u8, ok: i64, pass: *i64, fail: *i64) -> i64 |
| 81 | func main(argc: i64, argv: *i64) -> i64 |