code wiki / (root) / nx_emu_ppc64le.nx

nx_emu_ppc64le.nx

buildroot/runtime/nx_emu_ppc64le.nx

6852 B148 linesdepth 3pulls 3 transitivereach 1 importersview sourcekind librarytopic emu
docsdependenciesstructsconstsfunctions

about

nx_emu_ppc64le.nx -- sovereign PowerPC64 little-endian interpreter (NX-EMU). Flat 32 GPRs + LR; little-endian data AND instructions (ppc64le stores instruction words LE, so a 4-byte LE fetch yields the standard PPC encoding). No delay slots. Decode/execute pure NishiLang per the Power ISA -- NO qemu (qemu-ppc64le = differential BENCHMARK that must agree). How Nishi CARRIES ppc64le execution. PPC bit numbering is MSB=0; a field at PPC bits [a..b] = std bits [31-b .. 31-a]. RT/RS=(w>>21)&0x1F, RA=(w>>16)&0x1F, RB=(w>>11)&0x1F, XO=(w>>1)&0x3FF, primary opcode=(w>>26)&0x3F. Forms used by the backend (verified via objdump): D addi/li(14); DS ld(58)/std,stdu(62); X add(31/266)/subf(40)/mulld(233)/or-mr(444)/ mfspr-mflr(339)/mtspr-mtlr(467); XL blr(19/16); I bl(18); SC sc(17). license_tier: ORIGINAL

dependencies 1 imports · 1 importers

nx_syscalls_x86_64.nx nx_emu_ppc64le.nx nx_emu_ppc64le_main.nx

imports: nx_syscalls_x86_64.nx

imported by: nx_emu_ppc64le_main.nx

structs

none

consts

18const PP_MAGIC_200000000: i64 = 200000000
20const PP_GUEST_SIZE: i64 = 16777216
21const PP_SYS_READ: i64 = 3
22const PP_SYS_WRITE: i64 = 4
23const PP_SYS_EXIT: i64 = 1
24const PP_SYS_EXITG: i64 = 234
25const PPE_UNSUPPORTED: i64 = -1
26const PPE_FAULT: i64 = -3

functions

28func pp_g_ld(mem: *u8, va: i64, width: i64) -> i64 { // little-endian
34func pp_g_st(mem: *u8, va: i64, width: i64, val: i64) -> i64
called by 1: emu_ppc64le_run_mem
39func pp_sx16(x: i64) -> i64 { if (x & 0x8000) != 0 { return x - 0x10000 } return x }
called by 1: emu_ppc64le_run_mem
41func emu_ppc64le_run_mem(mem: *u8, mem_size: i64, entry: i64, sp0: i64) -> i64
128func emu_ppc64le_load_elf(buf: *u8, len: i64) -> i64
called by 1: main calls 2: pp_g_ldemu_ppc64le_run_mem