ScarletNX now. FP runs on the host's IEEE unit only behind guards that prove the result and the cumulative flags
equal the soft-float helper's, and the helper runs otherwise (sg_fp_fast_binary, sg_fp_fast_sqrt and sg_fp_fast_fma in
tools/sailgen/llvm.h). The helpers follow the Arm ARM for NaN propagation, the default NaN, flush
to zero and every rounding mode (src/common/cpu/aarch64/helpers/fp.c), and no FP group differs from QEMU
(tests/native_qemu_expected.txt). A directed rounding mode sends every operation to a helper. The FMA fast path waits
until FPSR.IXC is set and needs a host FMA. Halves, scalar FRINT* and FJCVTZS always call helpers. The
fpsr_flags setting (default 1) keeps FPSR exact.
On each host. The guards are host-generic, because each proves the host result equal to the helper's whatever the
host's own rules are. That covers RISC-V, which never propagates a NaN payload, since the fast paths never produce a
NaN. Only ties-away rounding (FRINTA, FCVTA*) has a fast path limited to AArch64 hosts, which have that rounding
instruction (tools/sailgen/llvm.h). An AArch64 host can drop the guards altogether, as Rosetta's hardware mode lets it (I12).
llvm.roundeven family for scalar
FRINT* as the vector form already does.tools/sailgen/llvm.h, ir_vec_fp.c.--sweep, on each host.MRS FPSR and at
exits, and keep FPCR.AH clear on hosts with FEAT_AFP. Mark functions with LLVM's dynamic denormal mode so constant
folding does not assume the default environment.tools/sailgen/llvm.h, ir_vec_fp.c, ir_codegen.c, the thread loop and the SVC entry in the runtime.Rosetta 2. x86's locked instructions become Arm atomics. The direction is the reverse here.
ScarletNX now. The Switch's Cortex-A57 has no LSE atomics, so compiled code builds every atomic from LDXR/STXR
loops. LDXR arms four monitor fields in CPU. STXR loads them, does a locked compare and swap and clears the
monitor (ir_ldst.c, ir_helpers.c). The monitor compares values, so it cannot see ABA, as in Dynarmic.
On each host. LLVM lowers a compare and swap to lock cmpxchg on x86-64, to LSE or an exclusive loop on AArch64,
and to reservation loops on PowerPC64, RISC-V and LoongArch. A 16-byte compare and swap goes through RtAPI.cas128 on
RISC-V and LoongArch (docs/hosts/riscv-loongarch.md).
ADD, SUB, AND,
ORR, EOR, a plain swap, or a compare that branches out for a compare and swap), store exclusive, and CBNZ back.
Emit one atomicrmw or cmpxchg with the loop's ordering. Leave the registers and flags as one successful pass of
the loop would, with the status register zero and the monitor clear.ir_ldst.c, ir_codegen.c.Rosetta translates the x86-64 system libraries too. Windows on Arm goes further with ARM64EC, which lets native code run inside an x64 process, and Box64 runs whole native host libraries in place of translated ones.
memcpy, memset, memmove, memcmp and strlen in the game's SDK
by dynamic symbol name together with a hash of their code. Replace their bodies with host routines that work on guest
memory through c->mem, in the module's runtime library, so each host gets its own best version.
Register these replacements through the expanded hook system and coordinate with the planned SDK layer instead
of maintaining duplicate replacements. Preserve guest memory
permissions, GPU ownership traps and callback/state contracts at each supported entry point.codegen.c, rtlib.c, ir_codegen.c.Made from docs/layers/cpu/plan.md at 69237645142c. GPL-3.0-or-later.