code wiki / (root) / nx_sovereign_runner.nx

nx_sovereign_runner.nx

buildroot/runtime/nx_sovereign_runner.nx

3206 B98 linesdepth 5pulls 8 transitivereach 0 importersview sourcekind tooltopic sovereign
docsdependenciesstructsconstsfunctions

about

nx_sovereign_runner.nx -- read an ELF off disk via OUR fs primitive, load it into OUR simulator, step every instruction in NishiLang. Demonstrates the full sovereign chain operating on a real file: sys_read_file (NishiLang) read ELF bytes from disk nx_loader_load (NishiLang) parse + place segments nx_rv64_cpu_new (NishiLang) initialize CPU nx_rv64_run (NishiLang) step every instruction Hardcoded path "/tmp/nx_sov_inner.elf" — caller stages the file there before invoking. Once nx_argv is hooked up to main(), the path becomes argv[1]. Exits with: 0 = ran successfully, propagates inner.exit_code via sys_exit (so smoke script sees the inner program's exit code directly) 1 = file read failed 2 = loader rejected 3 = simulator step error 4 = simulator did not halt

dependencies 3 imports · 0 importers

syscalls.nx nx_loader.nx nx_rv64_sim.nx nx_sovereign_runner.nx

imports: syscalls.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

main sys_read_file sys_openat_rd sys_lseek sys_mmap sys_read sys_close nx_loader_load nx_elf_parse_header nx_elf_get_u16_le nx_elf_get_u64_le nx_elf_get_u32_le nx_loader_read_phdr nx_elf_get_u32_le ↻ nx_elf_get_u64_le ↻ nx_loader_memcpy nx_loader_memzero nx_rv64_cpu_new nx_rv64_cpu_set_sp nx_rv64_run nx_rv64_step nx_rv64c_decode nx_c_decode_q0 nx_c_field nx_c_enc_i nx_c_reg3 nx_c_enc_s nx_c_decode_q1 nx_c_field ↻ nx_c_sext nx_c_enc_i ↻ nx_c_enc_u nx_c_reg3 ↻ nx_c_enc_r nx_c_enc_j nx_c_enc_b nx_c_decode_q2 nx_c_field ↻ nx_c_enc_i ↻ nx_c_enc_r ↻

structs

none

consts

31const K_MAGIC_16777216: i64 = 16777216
32const K_MAGIC_10000000: i64 = 10000000

functions

34func main() -> i64