code wiki / _hdl_build / nx_doctor_asm_fix.nx
nx_doctor_asm_fix.nx
buildroot/runtime/_hdl_build/nx_doctor_asm_fix.nx
about
nx_doctor_asm_fix.nx -- the DOCTOR fixes the miscompile in the MACHINE CODE, from the
Engineer's artifact (which register, which call line). The fix is the textbook caller-
save proven correct by the G1 allocator model (nx_regalloc_calls): a value that must
survive a call is SPILLED across it. At the assembly level that is `pushq %reg` right
before the offending call and `popq %reg` right after -- the call's clobber of the
caller-saved register no longer matters, because the value is restored from the stack.
One emit pass, milliseconds. RACI: the Doctor only PRODUCES the patched candidate; the
Engineer re-verifies (re-scan + execute) and the Council admits. Depends only on
syscalls -- decoupled from the Engineer. license_tier: ORIGINAL
dependencies 1 imports · 2 importers
imports: nx_syscalls.nx
imported by: nx_asm_selfheal_test.nxnx_engineer_build_gate.nx
structs
| none |
consts
| 12 | const K_MAGIC_4096: i64 = 4096 |
functions
| 14 | func doc_regname(id: i64) -> *u8 called by 1: doc_asm_fix |
| 27 | func doc_emit(out: *u8, oi: i64, s: *u8) -> i64 called by 1: doc_asm_fix |
| 33 | func doc_write_file2(path: *u8, buf: *u8, len: i64) -> i64 |
| 44 | func doc_asm_fix(in_path: *u8, out_path: *u8, fl_reg: *i64, fl_line: *i64, nflags: i64) -> i64 called by 2: asm_heal_runeng_build_gate calls 5: sys_mmapsys_read_filedoc_emitdoc_regnamedoc_write_file2 |