code wiki / _hdl_build / nx_asm_selfheal_test.nx

nx_asm_selfheal_test.nx

buildroot/runtime/_hdl_build/nx_asm_selfheal_test.nx

4942 B89 linesdepth 3pulls 6 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_asm_selfheal_test.nx -- the WHOLE loop, from MACHINE CODE up, in one fast pass, clean RACI. The bug is a real register-pressure miscompile living in emitted x86-64 assembly (a value live across a call in a caller-saved register). No synthetic probe: ENGINEER detect (eng_asm_scan) -> finds %rax live across the call, from the .s DOCTOR fix (doc_asm_fix) -> wraps that call with pushq/popq, into a NEW .s ENGINEER re-scan (eng_asm_scan) -> the patched .s is CLEAN (0 flags) ENGINEER execute (eng_link/eng_run) -> broken returns 7 (wrong), fixed returns 42 (right) COUNCIL admit (cc_council) -> ACTs on the Engineer's runtime verdict Known answer: detected=1, clean=0, broken-runs=7, fixed-runs=42, council ACT -> exit 0. All work is in asm_heal_run (fills memory arrays); main stays tiny so the gate that proves it is not itself a victim of the register-pressure miscompile it heals.

dependencies 4 imports · 0 importers

nx_eng_asm_scan.nx nx_doctor_asm_fix.nx nx_engineer_crash.nx nx_crew_council.nx nx_asm_selfheal_test.nx

imports: nx_eng_asm_scan.nxnx_doctor_asm_fix.nxnx_engineer_crash.nxnx_crew_council.nx

imported by: nobody (leaf or entry point)

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

main ap_puts asm_heal_run eng_asm_scan sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close as_proc_line as_is_ws as_mnem_class as_match as_isalnum sys_mmap ↻ as_operand_reg as_reg_at as_match ↻ as_is_caller as_read as_is_caller ↻ as_write doc_asm_fix sys_mmap ↻ sys_read_file ↻ doc_emit doc_regname doc_write_file2 sys_openat_wr sys_write sys_close ↻ eng_link sys_mmap ↻ sys_fork sys_openat_wr ↻ sys_dup3 sys_close ↻ sys_execve

structs

none

consts

none

functions

18func ap_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
19func ap_num(v: i64) -> i64
called by 1: asm_heal_report calls 1: ap_puts
28func tally(r: *i64, n: i64) -> i64
called by 1: main
36func asm_heal_run(s: *i64, r: *i64) -> i64
69func asm_heal_report(s: *i64) -> i64
78func main() -> i64