nx_nxc_native_wrap.nx
buildroot/runtime/nx_nxc_native_wrap.nx
about
nxc_native_wrap.nx -- sovereign bootstrap-verification driver.
One-shot main() that proves the off-C runtime path works:
1. Read an RV64 ELF from disk (built via stage 1's gcc-anchor
OR via the in-NishiLang nxc.elf compiler).
2. Validate the ELF via nx_elf_read.
3. Allocate a 16 MB flat memory region.
4. Load segments into memory via nx_loader.
5. Set sp to the top of memory minus 64 bytes.
6. Run via nx_rv64_sim with a 100M-instruction budget.
7. Report exit code + instruction count to stderr.
Usage:
nxc_native_wrap path/to/program.elf
Returns:
0 = program executed cleanly via simulator
1 = invalid ELF
2 = load failed (e.g. segment OOB)
3 = simulator hit illegal instruction
4 = budget expired
N = the simulated program exited with code N (passed through)
Pairs with bootstrap_native.sh. Once this lands + works, we have
the full off-C verification: produce ELF in NishiLang, run ELF in
NishiLang, compare exit code with stage 1. Sovereign stage 2 is
achieved.
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_elf_read.nxnx_loader.nxnx_rv64_sim.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 40 | const NX_MAGIC_4194304: i64 = 4194304 |
| 42 | const NX_WRAP_MEM_SIZE: i64 = 16777216 // 16 MB sim memory |
| 43 | const NX_WRAP_BUDGET: i64 = 100000000 // 100M instructions |
functions
| 47 | func nx_wrap_read_file(path: *u8, out_len: *i64) -> *u8 |
| 71 | func nx_wrap_log(s: *u8) -> i64 |
| 81 | func nx_wrap_logn(label: *u8, v: i64) -> i64 |
| 119 | func main(argc: i64, argv: *i64) -> i64 |