code wiki / (root) / nx_emu_s390x.nx

nx_emu_s390x.nx

buildroot/runtime/nx_emu_s390x.nx

6310 B138 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind orphan librarytopic emu
docsdependenciesstructsconstsfunctions

about

nx_emu_s390x.nx -- sovereign IBM Z (s390x) interpreter (NX-EMU). 64-bit big-endian, 16 GPRs, VARIABLE-LENGTH instructions (length from the top 2 bits of byte0: 00->2, 01/10->4, 11->6). Decodes the subset nxc2's s390x backend emits: BCR(br) RI(aghi/lghi) RRE(agr/lgr/msgr/sgr) RX(la) RXY(lg/stg) RSY(lmg/stmg) RIL(brasl) + SVC. Linux s390x: svc <imm>=number, args r2.., exit=1 (code in r2). NO qemu. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls_x86_64.nx nx_emu_s390x.nx

imports: nx_syscalls_x86_64.nx

imported by: nobody (leaf or entry point)

structs

none

consts

9const SZ_GUEST: i64 = 16777216
10const SZ_SYS_EXIT: i64 = 1

functions

12func sz_ld(mem: *u8, va: i64, width: i64) -> i64 { var v: i64 = 0; var i: i64 = 0; while i < width { v = (v << 8) | (mem[va + i] & 0xff); i = i + 1 } return v } // big-endian
called by 1: emu_s390x_run_mem
13func sz_st(mem: *u8, va: i64, width: i64, val: i64) -> i64 { var i: i64 = 0; while i < width { mem[va + (width - 1 - i)] = (val >> (i * 8)) & 0xff; i = i + 1 } return 0 }
called by 1: emu_s390x_run_mem
14func sz_sx(v: i64, bits: i64) -> i64 { let m: i64 = 1 << (bits - 1); if (v & m) != 0 { return v - (1 << bits) } return v }
called by 1: emu_s390x_run_mem
16func emu_s390x_run_mem(mem: *u8, mem_size: i64, entry: i64, sp0: i64) -> i64
called by 1: emu_s390x_run calls 3: sz_sxsz_ldsz_st
133func emu_s390x_run(code: *u8, code_len: i64) -> i64