code wiki / (root) / nx_pe_compile_win_index.nx

nx_pe_compile_win_index.nx

buildroot/runtime/nx_pe_compile_win_index.nx

15223 B267 linesdepth 4pulls 6 transitivereach 0 importersview sourcekind tooltopic pe
docsdependenciesstructsconstsfunctions

about

nx_pe_compile_win_index.nx -- keystone-linker for a MEDIUM organ (the sovereign inverted INDEX) -> native Windows PE. Extends nx_pe_compile_win_organ (0x400 .text, mmap+write+exit HAL) to a 0x2000 (8KB) .text so a real index organ's code fits; .idata shifts RVA 0x2000->0x3000 accordingly (all import RVAs +0x1000). Same 5 kernel32 imports (GetProcessHeap/HeapAlloc/GetStdHandle/WriteFile/ExitProcess). Emits _offc/nx_win_search_index.exe. This is the multi-target / platform-independence step: the SAME index .nx that runs on Linux ELF now compiles + runs as a native Windows PE (and the bounded footprint -- nx_inv_new_bounded -- means HeapAlloc suffices). PIPELINE: index_src.nx -> nx_compile_x86_native > /tmp/nxwin.s -> this -> _offc/nx_win_search_index.exe -> run native. license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_syscalls.nx nxasm_x86.nx nx_pe_writer.nx nx_pe_compile_win_index.nx

imports: nx_syscalls.nxnxasm_x86.nxnx_pe_writer.nx

imported by: nobody (leaf or entry point)

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

main sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close nxorg_assemble sys_mmap ↻ axc_pass axc_is_space axc_is_ident axc_apply_section axc_tok_is axc_cstr_len axc_is_space ↻ axc_is_ident ↻ axc_tok_is ↻ axc_emit_bytes axc_is_digit axc_parse_int axc_is_digit ↻ axc_parse_operand axc_is_space ↻ axc_is_ident ↻ axc_reg_num axc_tok_is ↻ axc_parse_int ↻ axc_is_digit ↻ axc_tok_is ↻ axc_emit axc_tok_is ↻ axc_alu x86_alu_imm x86_rex_w x86_modrm x86_put_u32le x86_alu_rr x86_rex_w ↻

structs

none

consts

13const NXORG_CODE_CAP: i64 = 1048576
14const NXORG_FILE_SIZE: i64 = 0x2400 // headers(0x200) + .text(0x2000) + .idata(0x200)
15const NXORG_STUB_LEN: i64 = 18
16const NXORG_HLEN: i64 = 29 // halloc thunk
17const NXORG_WLEN: i64 = 66 // write thunk
18const NXORG_ELEN: i64 = 13 // exit thunk
19const NXORG_TEXT_CAP: i64 = 0x2000 // .text raw region (file 0x200..0x2200) -- 8KB for a real index organ
20const NXORG_RVA_TEXT: i64 = 0x1000
21const NXORG_RVA_IDATA: i64 = 0x3000 // .text raw 0x2000 -> virtual 0x2000 -> idata at 0x3000
22const NXORG_FOFF_TEXT: i64 = 0x200
23const NXORG_FOFF_IDATA:i64 = 0x2200
24const NXORG_IAT_GPH: i64 = 0x3058
25const NXORG_IAT_HA: i64 = 0x3060
26const NXORG_IAT_GSH: i64 = 0x3068
27const NXORG_IAT_WF: i64 = 0x3070
28const NXORG_IAT_EXIT: i64 = 0x3078

functions

30func nxorg_assemble(src: *u8, n: i64, out: *u8, out_cap: i64, p_main: *i64, p_mm: *i64, p_sw: *i64, p_se: *i64) -> i64
73func nxorg_emit_pe(buf: *u8, code: *u8, code_len: i64, main_off: i64, mm_off: i64, sw_off: i64, se_off: i64) -> i64
230func main() -> i64