code wiki / (root) / nx_emu_cortexm.nx

nx_emu_cortexm.nx

buildroot/runtime/nx_emu_cortexm.nx

8858 B167 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind orphan librarytopic emu
docsdependenciesstructsconstsfunctions

about

nx_emu_cortexm.nx -- sovereign ARMv7-M / Cortex-M (Thumb-2) interpreter (NX-EMU). Little-endian, MIXED 16/32-bit instructions (32-bit iff hw1[15:11] in {11101,11110, 11111} i.e. hw1>=0xE800), 16 GPRs + C flag. Decodes the subset nxc2's cortex_m backend emits: push/pop, mov(hi), movs, adds/subs/adcs/sbcs, sub-sp, ldr/str (16-bit imm5 + 32-bit T4 neg-offset), blx, movw, umull, mla, subw. Bare-metal: BKPT halts with result=r0 (no OS). NO qemu. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls_x86_64.nx nx_emu_cortexm.nx

imports: nx_syscalls_x86_64.nx

imported by: nobody (leaf or entry point)

structs

none

consts

9const CM_GUEST: i64 = 16777216
10const CM_MASK: i64 = 0xFFFFFFFF

functions

12func cm_ld(mem: *u8, va: i64, width: i64) -> i64 { var v: i64 = 0; var i: i64 = 0; while i < width { v = v | ((mem[va + i] & 0xff) << (i * 8)); i = i + 1 } return v }
called by 1: emu_cortexm_run_mem
13func cm_st(mem: *u8, va: i64, width: i64, val: i64) -> i64 { var i: i64 = 0; while i < width { mem[va + i] = (val >> (i * 8)) & 0xff; i = i + 1 } return 0 }
called by 1: emu_cortexm_run_mem
15func emu_cortexm_run_mem(mem: *u8, mem_size: i64, entry: i64, sp0: i64) -> i64
called by 1: emu_cortexm_run calls 2: cm_ldcm_st
162func emu_cortexm_run(code: *u8, code_len: i64) -> i64