code wiki / _hdl_build / nx_doctor_asm_fix.nx

nx_doctor_asm_fix.nx

buildroot/runtime/_hdl_build/nx_doctor_asm_fix.nx

3453 B88 linesdepth 2pulls 2 transitivereach 9 importersview sourcekind librarytopic doctor
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_doctor_asm_fix.nx nx_asm_selfheal_test.nx nx_engineer_build_gate.nx

imports: nx_syscalls.nx

imported by: nx_asm_selfheal_test.nxnx_engineer_build_gate.nx

structs

none

consts

12const K_MAGIC_4096: i64 = 4096

functions

14func doc_regname(id: i64) -> *u8
called by 1: doc_asm_fix
27func doc_emit(out: *u8, oi: i64, s: *u8) -> i64
called by 1: doc_asm_fix
33func doc_write_file2(path: *u8, buf: *u8, len: i64) -> i64
44func doc_asm_fix(in_path: *u8, out_path: *u8, fl_reg: *i64, fl_line: *i64, nflags: i64) -> i64