code wiki / _hdl_build / _trap_syscall_gate.nx

_trap_syscall_gate.nx

buildroot/runtime/_hdl_build/_trap_syscall_gate.nx

10145 B216 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

_trap_syscall_gate.nx -- the K-R1 gate (kernel-up ladder rung 1). Drives the full author->trap->syscall chain with NO mocks: runs the REAL nx_trap_syscall_emit (the team AUTHORS the rv64 trap+syscall image + the TABLE-COMPUTED golden transcript from the spec), then RUNS the image on the SOVEREIGN rv64 emulator (rv64im_min_sim -- the PRIMARY, gating lane: Nishi owns the runtime) and asserts the captured serial transcript CONTAINS the emitter's golden (banner + each syscall's emit byte, in order) AND the sovereign emu reports a clean SiFive-finisher halt (BOOTSOV verdict=GREEN). Then it runs the SAME image on qemu-system-riscv64 -machine virt (the declared hardware-alignment lane, NOT the runtime -- the diff-lane signal) and asserts the lanes AGREE on the transcript. Finally a TAMPER test: corrupt one syscall's a7 in the image -> that handler never fires -> the transcript loses a byte -> the gate must go RED (proves the gate bites, not a rubber stamp). Evidence -> knowledge/status/ trap_syscall.log (TRAPGATE row; the queue row's ||MARK= reads it). Sovereign orchestration (fork/dup3/execve/wait4). license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx _trap_syscall_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 ↻ sys_mmap ↻ g_read sys_openat_rd sys_read sys_close ↻ g_run_sov sys_fork ↻ sys_openat_wr ↻ sys_dup3 ↻ sys_mmap ↻ sys_execve ↻ sys_exit ↻ sys_wait4 ↻ g_buf_has g_run_qemu sys_fork ↻ sys_openat_wr ↻ sys_dup3 ↻ sys_mmap ↻ sys_execve ↻ sys_exit ↻ sys_wait4 ↻ sys_openat_wr ↻ sys_write ↻

structs

none

consts

none

functions

17func 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
18func 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
19func 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
22func g_run_emit(spec: *u8) -> i64
43func g_run_qemu(binpath: *u8, outpath: *u8) -> i64
68func g_run_sov(binpath: *u8, outpath: *u8) -> i64
89func g_read(path: *u8, buf: *u8, cap: i64) -> i64
100func g_buf_has(buf: *u8, n: i64, pat: *u8, pl: i64) -> i64
called by 2: g_file_hasmain
113func g_strlen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: g_file_has
116func g_file_has(path: *u8, pat: *u8) -> i64
122func main() -> i64