code wiki / _hdl_build / _boot_stub_gate.nx

_boot_stub_gate.nx

buildroot/runtime/_hdl_build/_boot_stub_gate.nx

6708 B152 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind gate/prooftopic boot
docsdependenciesstructsconstsfunctions

about

_boot_stub_gate.nx -- the K-R0 gate (kernel-up ladder rung 0). Drives the full author->boot chain with NO mocks: runs the REAL nx_boot_stub_emit (the team authors the stub from the spec), then runs the REAL qemu-system-riscv64 -machine virt (the declared hardware-oracle lane, per the ladder), captures the serial output, and asserts the K-R0 acceptance: banner "NISHI" on serial + clean exit (qemu status 0, the SiFive finisher pass). Evidence -> knowledge/status/boot_stub.log (BOOTGATE row, the row's ||MARK= reads it). Sovereign orchestration (fork/dup3/execve/wait4). NOTE: the emitted stub ALWAYS writes the finisher, so qemu self-exits; no watchdog needed for our own artifact (a watchdog is a hardening follow-up if arbitrary stubs are ever gated). license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx _boot_stub_gate.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main g_p sys_write g_run_emit sys_fork sys_openat_wr sys_dup3 sys_mmap sys_execve sys_exit sys_wait4 sys_openat_append g_fp sys_write ↻ sys_close sys_exit ↻ g_run_sov sys_fork ↻ sys_openat_wr ↻ sys_dup3 ↻ sys_mmap ↻ sys_execve ↻ sys_exit ↻ sys_wait4 ↻ g_file_has sys_mmap ↻ sys_openat_rd sys_read sys_close ↻ g_run_qemu sys_fork ↻ sys_openat_wr ↻ sys_dup3 ↻ sys_mmap ↻ sys_execve ↻ sys_exit ↻ sys_wait4 ↻ g_fn sys_mmap ↻ sys_write ↻

structs

none

consts

none

functions

13func g_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 calls 1: sys_write
14func g_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 calls 1: sys_write
15func g_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 calls 2: sys_mmapsys_write
18func g_run_emit(spec: *u8) -> i64
39func g_run_qemu(binpath: *u8, outpath: *u8) -> i64
64func g_run_sov(binpath: *u8, outpath: *u8) -> i64
85func g_file_has(path: *u8, pat: *u8) -> i64
106func main() -> i64