code wiki / _hdl_build / nx_x86emit_gate.nx

nx_x86emit_gate.nx

buildroot/runtime/_hdl_build/nx_x86emit_gate.nx

7948 B175 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_x86emit_gate.nx -- VERIFY the sovereign x86-64 emitter (nx_x86emit) by EMITTING functions through its api and EXECUTING them (cardinal rule 2: verify the primitive before the JIT rides it). Each test emits a tiny function via the SAME encoders the Sparkplug-tier JIT will use, casts the RWX buffer to a fn-ptr, calls it, and checks the result. Any encoding bug shows as a wrong value or a SIGSEGV/SIGILL here -- never silently in the JIT. Covers: reg-moves, imm32/imm64, arithmetic, imul, signed idiv (cqo+idiv), setcc booleanization, [base+disp] load/store, [base+index] SIB load/store (the VM stack access pattern), forward jcc + backward jmp (a real counted loop), and an indirect CALL through a register (the native->helper path). expect_exit: 0 license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_x86emit.nx nx_x86emit_gate.nx

imports: nx_x86emit.nx

imported by: nobody (leaf or entry point)

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

main g_puts xe_mmap_rwx xe_mov_rr xe_rex xhi xe1 xe1 ↻ xe_modrm xe1 ↻ xlo xe_add_ri32 xe_rex ↻ xe1 ↻ xe_modrm ↻ xe_u32 xe1 ↻ xe_imul_rr xe_rex ↻ xe1 ↻ xe_modrm ↻ xe_sub_rr xe_rex ↻ xe1 ↻ xe_modrm ↻ xe_ret xe1 ↻ chk g_puts ↻ g_pn xe_mov_ri32 xe_rex ↻ xe1 ↻ xe_modrm ↻ xe_u32 ↻ xe_cqo xe1 ↻ xe_idiv xe_rex ↻ xe1 ↻

structs

none

consts

none

functions

11func g_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 2: chkmain
12func g_pn(v: i64) -> i64
called by 2: chkmain
26func chk(label: *u8, got: i64, want: i64, pp: *i64, tp: *i64) -> i64
called by 1: main calls 2: g_putsg_pn
39func helper_triple(x: i64) -> i64 { return x * 3 }
41func main() -> i64