code wiki / (root) / nx_emu_mips64.nx

nx_emu_mips64.nx

buildroot/runtime/nx_emu_mips64.nx

6605 B126 linesdepth 3pulls 3 transitivereach 1 importersview sourcekind librarytopic emu
docsdependenciesstructsconstsfunctions

about

nx_emu_mips64.nx -- sovereign MIPS64 (n64, big-endian) interpreter (NX-EMU). Flat 32 GPRs (r0==zero), BIG-ENDIAN, DELAY SLOTS (PC/nPC model like SPARC). Decode/execute pure NishiLang per the MIPS64 ISA -- NO qemu (qemu-mips64 = differential BENCHMARK that must agree). Resolves the earlier "inconclusive" run-proof (that was a qemu-harness ABI artifact; here Nishi carries it). Forms: R-type opcode0 (funct): OR 0x25 / DADDU 0x2d / DSUBU 0x2f / AND 0x24 / XOR 0x26 / DMUL(R6) funct 0x1c sa 2 / JR 0x08 / JALR 0x09 / SLL 0x00 (nop) / SYSCALL 0x0c / DSLL 0x38 / DSRL 0x3a / DSRA 0x3b. I-type: ADDIU 0x09 / DADDIU 0x19 / ORI 0x0d / LUI 0x0f / LD 0x37 / SD 0x3f. J-type: J 0x02 / JAL 0x03 (link r31=pc+8). n64 syscalls v0=num,a0..=args: exit=5058. license_tier: ORIGINAL

dependencies 1 imports · 1 importers

nx_syscalls_x86_64.nx nx_emu_mips64.nx nx_emu_mips64_main.nx

imports: nx_syscalls_x86_64.nx

imported by: nx_emu_mips64_main.nx

structs

none

consts

16const MI_MAGIC_200000000: i64 = 200000000
18const MI_GUEST_SIZE: i64 = 16777216
19const MI_SYS_READ: i64 = 5000
20const MI_SYS_WRITE: i64 = 5001
21const MI_SYS_EXIT: i64 = 5058
22const MI_SYS_EXITG: i64 = 5205
23const MIE_UNSUPPORTED: i64 = -1
24const MIE_FAULT: i64 = -3

functions

26func mi_g_ld(mem: *u8, va: i64, width: i64) -> i64 { // big-endian
32func mi_g_st(mem: *u8, va: i64, width: i64, val: i64) -> i64
called by 1: emu_mips64_run_mem
37func mi_sx16(x: i64) -> i64 { if (x & 0x8000) != 0 { return x - 0x10000 } return x }
called by 1: emu_mips64_run_mem
38func mi_rd(r: *i64, n: i64) -> i64 { if n == 0 { return 0 } return r[n] }
called by 1: emu_mips64_run_mem
39func mi_wr(r: *i64, n: i64, v: i64) -> i64 { if n != 0 { r[n] = v } return 0 }
called by 1: emu_mips64_run_mem
41func emu_mips64_run_mem(mem: *u8, mem_size: i64, entry: i64, sp0: i64) -> i64
106func emu_mips64_load_elf(buf: *u8, len: i64) -> i64
called by 1: main calls 2: mi_g_ldemu_mips64_run_mem