code wiki / _hdl_build / nx_eng_asm_scan.nx

nx_eng_asm_scan.nx

buildroot/runtime/_hdl_build/nx_eng_asm_scan.nx

9948 B228 linesdepth 2pulls 2 transitivereach 10 importersview sourcekind librarytopic eng
docsdependenciesstructsconstsfunctions

about

nx_eng_asm_scan.nx -- the ENGINEER reads the bug straight from the MACHINE CODE. Not a synthetic probe (those don't reproduce it) -- a single deterministic pass over the emitted x86-64 assembly that finds the register-pressure miscompile WHERE IT LIVES: a CALLER-SAVED register is written, a `call` happens, then that register is READ again with no spill+reload in between -> the call clobbered it -> wrong value. x86-64 SysV: caller-saved = rax,rcx,rdx,rsi,rdi,r8,r9,r10,r11 (a call destroys them); callee-saved = rbx,rbp,r12-r15 (survive). Per-register state: CLEAN(0) -> FRESH(1) on a write -> CLOBBERED(2) when a call crosses it while FRESH. A read of a CLOBBERED caller- saved reg is the bug; a write or a reload-from-memory makes it FRESH (safe) again. State resets at each function label. One pass, milliseconds -- identify from machine code up. RACI: detection only. The Engineer reports (reg + the clobbering call's line); the Doctor consumes that artifact to fix. license_tier: ORIGINAL

dependencies 1 imports · 3 importers

nx_syscalls.nx nx_eng_asm_scan.nx nx_asm_selfheal_test.nx nx_eng_asm_scan_min_test.nx nx_engineer_build_gate.nx

imports: nx_syscalls.nx

imported by: nx_asm_selfheal_test.nxnx_eng_asm_scan_min_test.nxnx_engineer_build_gate.nx

structs

none

consts

18const AS_CLEAN: i64 = 0
19const AS_FRESH: i64 = 1
20const AS_CLOBBERED: i64 = 2

functions

22func as_isalnum(c: i64) -> i64
called by 1: as_match
31func as_match(buf: *u8, p: i64, lim: i64, lit: *u8) -> i64
called by 2: as_reg_atas_mnem_class calls 1: as_isalnum
43func as_reg_at(buf: *u8, p: i64, lim: i64) -> i64
called by 1: as_operand_reg calls 1: as_match
63func as_is_caller(id: i64) -> i64
called by 2: as_readas_proc_line
77func as_operand_reg(buf: *u8, s: i64, e: i64, ismem: *i64) -> i64
called by 1: as_proc_line calls 1: as_reg_at
91func as_mnem_class(buf: *u8, ms: i64, lim: i64) -> i64
called by 1: as_proc_line calls 1: as_match
111func as_read(reg: i64, state: *i64, clobline: *i64, fl_reg: *i64, fl_line: *i64, nf: *i64) -> i64
called by 1: as_proc_line calls 1: as_is_caller
120func as_write(reg: i64, state: *i64) -> i64 { if reg >= 0 { state[reg] = AS_FRESH } return 0 }
called by 1: as_proc_line
123func as_is_ws(c: i64) -> i64 { if c == 32 { return 1 } if c == 9 { return 1 } return 0 }
called by 1: as_proc_line
126func as_proc_line(buf: *u8, ls: i64, le: i64, line: i64, state: *i64, clobline: *i64,
193func eng_asm_scan(path: *u8, fl_reg: *i64, fl_line: *i64) -> i64
217func as_regname(id: i64) -> *u8
called by 2: asm_heal_reportmain