Shared CPU ABI (src/common/cpu/aarch64/): guest functions take CPU*; snx_lookup dispatches indirect branches
through CPU.disp (relaxed loads: slots go from NULL to a function while threads run), and a pc without a function
goes to RtAPI.miss. CPU.rt supplies RtAPI callbacks: SVC (and NX's table of SVCs by number), UNDEF, BRK, hints, CNTVCT, FPCR, SEV/WFE, poll,
miss, and the 16-byte compare-and-swap of STXP on RISC-V, LoongArch and MIPS64 hosts; no named runtime imports. NX's miss (src/nx/runtime/rtapi.c) runs the runtime JIT's code
(src/nx/runtime/guest_jit.c over src/common/cpu/recompiler/jit/jit_service.c), and under NCE the game's native code
(nce_slot). There is no interpreter: a pc
without code yet is queued in the live misses' queue and its thread waits for the compile off its guest core, and a pc
the JIT can't compile (or a host where it can't start: Windows before 10 1803) ends the game with the reason. Compile
threads (host threads, not guest threads) take the queued pcs in batches: the functions at them and their callees
found by snx_codegen_discover, made by the host's native back end into one object, loaded into a code arena with a
copy of the runtime library (code_loader.c, packed into shared memory mapped once executable and once writable) and published into
CPU.disp. At start the hints of earlier runs are queued behind every miss. The pc is recorded as a hint either way,
so the next recompile has it. Each unit compiled is appended to <game>.jitcache in the cache folder, and a later run
loads it instead of compiling when the guest code it came from is the same byte for byte and the file was written with
the same ABI, native back end and code, host features, runtime library and settings. Its calls into the AOT
module go through snx_aot_<pc> symbols that the loader resolves at each load, so the object holds no host address.
cpu_helpers.c + helpers/: SIMD, crypto, FP.
GNU supplies an optional fetch callback that checks execute permissions and compares the live instruction against the compiled word. Modified code falls back to shared interpreter semantics. NX leaves this callback unset and keeps its existing execution path.
Made from docs/dev/architecture.md at 69237645142c. GPL-3.0-or-later.