nx_isa_conform_gate.nx
buildroot/runtime/nx_isa_conform_gate.nx
about
nx_isa_conform_gate.nx -- THE ISA CONFORMANCE RULER.
WHY IT EXISTS: the estate carries TEN sovereign ISA emulators in
NishiLang (rv64 arm64 armv7a cortexm loongarch64 mips64 ppc64le
riscv32 s390x sparc64). Measured 2026-09-03 by nx_catalog: all ten
are SOURCE-ONLY -- 0 built, 0 promoted, 0 registered, 0 invoked --
ONE of them had a KAT (rv64), two more had x86 tests, and the only
differential proof in the estate was bench/gate_nx_emu_diff.sh, a
SHELL script that needs WSL plus riscv64 binutils plus qemu in order
to judge anything. Eight emulators had never been measured at all.
THE LAW THIS ORGAN OBEYS: a capability asserted and never measured is
a claim, not coverage. "We emulate MIPS64" is decided by running
MIPS64 machine code, in process, against values taken FROM THE ISA
MANUAL -- never from the emulator's own source, which would calibrate
the ruler to the subject it is meant to judge.
FIVE OUTCOMES, NEVER ONE:
PASS ran and matched the manual-derived expectation
WRONG-ANSWER ran to completion and computed the wrong value
UNSUPPORTED hit an instruction class the emulator does not implement
RAN-OFF-END the interpreter loop ended without an exit syscall
FAULT bad PC, out-of-range access, or the step budget
Collapsing these into "FAIL" is what makes a gap unactionable: an
unimplemented instruction class and a miscomputed result need
OPPOSITE fixes, and only the first is a missing feature.
CORRECTION, 2026-09-03: the first cut of this header claimed "neither
emulator can return -2, so the codes do not collide with a real
answer". THAT WAS FALSE and I wrote it without reading far enough:
nx_emu_rv64.nx line 50 defines EMU_RV_RANOFF = -2 and line 123 uses
it as the INITIAL value of result, so -2 is exactly what comes back
when the loop ends with no exit syscall. Treating it as WRONG-ANSWER
would have reported a structural non-completion as an arithmetic
disagreement -- the same two-conditions-under-one-negative-word
defect this organ was written to refuse, committed inside the organ
that refuses it. Both exit paths mask with & 0xff (rv64 line 302,
mips64 SYSCALL), so a real answer is always 0..255 and the three
negative sentinels cannot collide with one.
dependencies 7 imports · 0 importers
imports: nx_gate_verdict.nxnx_syscalls.nxnx_emu_rv64.nxnx_emu_mips64.nxnx_emu_arm64.nxnx_emu_riscv32.nxnx_emu_ppc64le.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
| 72 | const IC_GUEST_BYTES: i64 = 1048576 // 1 MiB guest image |
| 73 | const IC_ENTRY: i64 = 0 // KAT code is loaded at guest vaddr 0 |
| 74 | const IC_SP: i64 = 983040 // 960 KiB: above the code, inside the image |
| 75 | const IC_MODE_FILE: i64 = 420 // 0644. Mirrors the consolidated MODE_0644; |
| 83 | const IC_UNSUPPORTED: i64 = -1 |
| 84 | const IC_RANOFF: i64 = -2 |
| 85 | const IC_FAULT: i64 = -3 |
| 88 | const IC_O_PASS: i64 = 0 |
| 89 | const IC_O_WRONG: i64 = 1 |
| 90 | const IC_O_UNSUP: i64 = 2 |
| 91 | const IC_O_FAULT: i64 = 3 |
| 92 | const IC_O_RANOFF: i64 = 4 |
| 100 | const IC_NB_BYTES: i64 = 2048 |
| 101 | const IC_NB_OFF: i64 = 0 |
| 102 | const IC_NB_PTR: i64 = 1 |
| 108 | const IC_NB_ROW_MAX: i64 = 256 |
| 109 | const IC_BOX_BYTES: i64 = 32 |
| 111 | const IC_NL: i64 = 10 |
| 112 | const IC_SPACE: i64 = 32 |
| 113 | const IC_DIG_LO: i64 = 48 |
| 114 | const IC_DIG_HI: i64 = 57 |
| 115 | const IC_UNSEEDED: i64 = -1 |
| 651 | const IC_RATCHET: *u8 = "knowledge/status/isa_conform.ratchet" |
functions
| 120 | func ic_nl() -> i64 |
| 134 | func ic_put_le32(code: *u8, off: i64, w: i64) -> i64 |
| 142 | func ic_put_be32(code: *u8, off: i64, w: i64) -> i64 |
| 150 | func ic_guest() -> *u8 { return sys_mmap(IC_GUEST_BYTES) } |
| 154 | func ic_classify(got: i64, want: i64) -> i64 |
| 162 | func ic_outcome_name(o: i64) -> *u8 |
| 173 | func ic_report(arch: *u8, kat: *u8, got: i64, want: i64, bx: *i64) -> i64 |
| 214 | func ic_rv64_imm_arith() -> i64 |
| 225 | func ic_rv64_sub() -> i64 |
| 236 | func ic_rv64_branch_loop() -> i64 |
| 256 | func ic_rv64_shift_logical() -> i64 |
| 266 | func ic_rv64_shift_arith() -> i64 |
| 276 | func ic_rv64_load_store() -> i64 |
| 291 | func ic_mi_addiu(rt: i64, rs: i64, imm: i64) -> i64 |
| 295 | func ic_mi_ori(rt: i64, rs: i64, imm: i64) -> i64 called by 1: ic_mips64_logic |
| 299 | func ic_mi_rtype(rs: i64, rt: i64, rd: i64, sa: i64, fn: i64) -> i64 |
| 303 | func ic_mi_beq(rs: i64, rt: i64, off: i64) -> i64 called by 1: ic_mips64_branch |
| 308 | func ic_mi_exit(m: *u8, o0: i64) -> i64 |
| 315 | func ic_mips64_imm_arith() -> i64 |
| 325 | func ic_mips64_sub() -> i64 |
| 335 | func ic_mips64_logic() -> i64 |
| 346 | func ic_mips64_shift() -> i64 |
| 362 | func ic_mips64_shift_logical() -> i64 |
| 378 | func ic_mips64_addiu32() -> i64 |
| 399 | func ic_mips64_branch() -> i64 |
| 422 | func ic_a64_movz(rd: i64, imm: i64, hw: i64) -> i64 |
| 425 | func ic_a64_movk(rd: i64, imm: i64, hw: i64) -> i64 called by 1: ic_arm64_movk_keeps_lanes |
| 428 | func ic_a64_add(rd: i64, rn: i64, rm: i64) -> i64 called by 1: ic_arm64_imm_arith |
| 431 | func ic_a64_madd(rd: i64, rn: i64, rm: i64, ra: i64) -> i64 called by 1: ic_arm64_madd |
| 434 | func ic_a64_cbz(rt: i64, off: i64) -> i64 called by 1: ic_arm64_cbz_taken |
| 439 | func ic_a64_exit(m: *u8, o0: i64) -> i64 |
| 446 | func ic_arm64_imm_arith() -> i64 |
| 459 | func ic_arm64_movk_keeps_lanes() -> i64 |
| 468 | func ic_arm64_madd() -> i64 |
| 482 | func ic_arm64_cbz_taken() -> i64 |
| 502 | func ic_riscv32_imm_arith() -> i64 |
| 513 | func ic_riscv32_sub() -> i64 |
| 524 | func ic_riscv32_logic() -> i64 |
| 537 | func ic_riscv32_mul() -> i64 |
| 548 | func ic_riscv32_load_store() -> i64 |
| 559 | func ic_riscv32_branch_loop() -> i64 |
| 590 | func ic_pp_exit(m: *u8, o0: i64) -> i64 |
| 597 | func ic_ppc64le_imm_arith() -> i64 |
| 609 | func ic_ppc64le_sub() -> i64 |
| 619 | func ic_ppc64le_mul() -> i64 |
| 631 | func ic_ppc64le_logic() -> i64 |
| 653 | func ic_match_at(buf: *u8, n: i64, p: i64, s: *u8) -> i64 called by 1: ic_ratchet_read |
| 667 | func ic_digits_at(buf: *u8, n: i64, p0: i64) -> i64 called by 1: ic_ratchet_read |
| 691 | func ic_ratchet_read(arch: *u8) -> i64 |
| 724 | func ic_ratchet_write(rv: i64, mi: i64, a64: i64, r32: i64) -> i64 |
| 753 | func main(argc: i64, argv: *i64) -> i64 |