code wiki / _hdl_build / nx_syscall_xlate_gate.nx

nx_syscall_xlate_gate.nx

buildroot/runtime/_hdl_build/nx_syscall_xlate_gate.nx

6533 B95 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind gate/prooftopic syscall
docsdependenciesstructsconstsfunctions

about

nx_syscall_xlate_gate.nx -- RATCHET gate for the compiler's rv64->x86_64 syscall translation table (x86ctx_rv64_to_x86_64_syscall in nx_x86_64_ctx.nx). The process-IDENTITY family was MISSING: a const rv64 getpid(172) fell through `return num` to raw x86_64 172=iopl -> -ENOSYS (-38). That silently filled a loop-singleton pidfile with -38 and the gate FAILED OPEN (two daemons raced -- see nx_gate_loop_register X-GETPID-XLATE). nx_signal/nx_swarm_queue/nx_rv64_sim/ml_pid_alive all wanted getpid via 172 and were silently broken. This gate calls each identity syscall via its rv64/asm-generic CONST number (exercising the const-translation path I fixed) and asserts a NON-ERROR result. A -errno (e.g. -38 ENOSYS from an un-translated passthrough) is negative and fails. If ANY row is dropped from the table, this goes RED. One test per row added (172/173/174/175/176/177). license_tier: ORIGINAL expect_exit:0

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_syscall_xlate_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 w sys_write n sys_mmap sys_write ↻ sys_mmap ↻

structs

none

consts

15const RV_GETPID: i64 = 172
16const RV_GETPPID: i64 = 173
17const RV_GETUID: i64 = 174
18const RV_GETEUID: i64 = 175
19const RV_GETGID: i64 = 176
20const RV_GETEGID: i64 = 177

functions

22func w(s: *u8) -> i64 { var k:i64=0; while s[k]!=(0 as u8){k=k+1} sys_write(1,s,k); return 0 }
called by 1: main calls 1: sys_write
23func n(v: i64) -> i64 { let b:*u8=sys_mmap(24); var m:i64=v; if m<0{sys_write(1,"-" as *u8,1);m=0-m} let t:*u8=sys_mmap(24); var k:i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var j:i64=0; while j<k{b[j]=t[k-1-j];j=j+1} sys_write(1,b,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
25func main() -> i64
calls 3: wnsys_mmap