code wiki / _hdl_build / nx_nishios_kernel_gate.nx

nx_nishios_kernel_gate.nx

buildroot/runtime/_hdl_build/nx_nishios_kernel_gate.nx

11176 B228 linesdepth 6pulls 18 transitivereach 0 importersview sourcekind gate/prooftopic nishios
docsdependenciesstructsconstsfunctions

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 2 imports · 0 importers

nx_bootcap.nx nx_gate_verdict.nx nx_nishios_kernel_gate.nx

imports: nx_bootcap.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main nkg_p nkg_tooth gv_ctr sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ gv_check gv_puts sys_write ↻ nkg_run bootcap_run bootcap_machine bootcap_machine_mem nkg_eq nkg_has nkg_fn gv_ctr ↻ gv_verdict gv_note_bare_rate gv_bare_rate gv_at gv_obj_has_n gv_at ↻ gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻

structs

none

consts

25const NKG_BIN: *u8 = "runtime/_hdl_build/_boot_nishi_virt.bin"
26const NKG_GOLD: *u8 = "runtime/_hdl_build/_boot_nishi_virt.bin.gold"
27const NKG_BIN_ALT: *u8 = "_boot_nishi_virt.bin"
28const NKG_GOLD_ALT: *u8 = "runtime/_hdl_build/_boot_nishi_virt.bin.gold"
29const NKG_LOG: *u8 = "knowledge/status/boot_stub.log"
31const NKG_MEM_BASE: i64 = 0x80000000
32const NKG_MEM_SIZE: i64 = 65536
33const NKG_TX_CAP: i64 = 4096
34const NKG_MAX_STEPS: i64 = 100000
35const NKG_BANNER_BYTES: i64 = 72
36const NKG_BANNER_STEPS: i64 = 17

functions

38func 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 }
called by 1: main
39func 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
40func nkg_fn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(fd,"-" as *u8,1)}; 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
45func nkg_run(img: *u8, ilen: i64, tx_buf: *u8, res: *i64) -> i64
called by 1: main calls 1: bootcap_run
50func nkg_eq(a: *u8, an: i64, b: *u8, bn: i64) -> i64
called by 1: main
57func nkg_has(hay: *u8, hn: i64, needle: *u8) -> i64
called by 1: main
81func nkg_tooth(name: *u8, ok: i64, pass: *i64, fail: *i64) -> i64
called by 1: main calls 2: gv_ctrgv_check
92func main(argc: i64, argv: *i64) -> i64