code wiki / _hdl_build / nx_x86_kat_gate.nx
nx_x86_kat_gate.nx
buildroot/runtime/_hdl_build/nx_x86_kat_gate.nx
about
nx_x86_kat_gate.nx -- SOVEREIGN x86_64 backend run-KAT gate (the gold per-ISA emit-proof tier,
hardware-rung-up, NO gcc / NO qemu / NO external binutils).
AUTHOR=ORGAN, no-false-green: the proof that nxc2's x86_64 backend EMITS CORRECT NATIVE code is a
RUN, not a structural guess. This gate composes the team's own toolchain end to end -- it forks
_offc/nx_sov_build_run.elf (nx_cc_sovereign -> nxasm_x86 -> execute) on two KAT modules and reads
their real process exit codes:
POS nx_emit_kat -> 42 (all three distinct KATs 37/10/81 computed correctly by the backend)
NEG nx_emit_kat_raw -> 37 (raw kat(7,5); proves the gate reads the ACTUAL exit, not a baked 42)
GREEN iff pos==42 AND neg==37 AND pos!=neg (distinct => no constant rubber-stamp). This is the
SOVEREIGN replacement for the external bench-parity / qemu proof: the whole trust path is Nishi
organs. Other ISAs reuse this shape, swapping the native run for their sovereign emulator
(nx_emu_rv64/arm64/mips64/ppc64le/loongarch64/sparc64). Writes knowledge/status/x86_64_kat_gate.log
so nx_portability_proof_census can credit x86_64 as SOVEREIGN-run-proven. license_tier: ORIGINAL
dependencies 1 imports · 0 importers
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
structs
| none |
consts
| 17 | const SBR: *u8 = "_offc/nx_sov_build_run.elf" |
| 18 | const KG_LOG: *u8 = "knowledge/status/x86_64_kat_gate.log" |
functions
| 20 | func kg_w(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 } |
| 21 | func kg_wn(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 } |
| 25 | func kg_run_mod(name: *u8) -> i64 |
| 49 | func kg_emit(fd: i64, pos: i64, neg: i64, ok: i64) -> i64 |
| 57 | func main() -> i64 |