code wiki / _hdl_build / nx_emu_x86.nx

nx_emu_x86.nx

buildroot/runtime/_hdl_build/nx_emu_x86.nx

2894 B62 linesdepth 3pulls 3 transitivereach 2 importersview sourcekind librarytopic emu
docsdependenciesstructsconstsfunctions

about

nx_emu_x86.nx -- a minimal sovereign x86-64 interpreter (the THIRD target family, after RV64 + AArch64). x86-64 is variable-length with REX/ModRM, so this decodes exactly the register-direct forms our machine-code generator emits -- enough to EXECUTE and thus PROVE x86 machine code, no qemu. Register-direct (mod=11) only, REX.W (0x48), regs 0..7 (rax rcx rdx rbx rsp rbp rsi rdi). Decoded forms (Intel SDM Vol.2): 48 C7 /0 id mov r/m64, imm32 (sign-extended) 48 89 /r mov r/m64, r64 48 C1 /4 ib shl r/m64, imm8 48 01 /r add r/m64, r64 48 29 /r sub r/m64, r64 0F 05 syscall (rax==60 -> exit(rdi & 0xff)) Returns the 8-bit exit status, or a negative sentinel on an unknown byte.

dependencies 1 imports · 2 importers

nx_syscalls_x86_64.nx nx_emu_x86.nx nx_emu_x86_boot_test.nx nx_emu_x86_test.nx

imports: nx_syscalls_x86_64.nx

imported by: nx_emu_x86_boot_test.nxnx_emu_x86_test.nx

structs

none

consts

none

functions

19func emu_x86_i32(code: *u8, off: i64) -> i64
called by 1: emu_x86_run
25func emu_x86_run(code: *u8, len: i64) -> i64
called by 3: mainx_runmain calls 1: emu_x86_i32