Rosetta 2. Apple silicon has a per-thread TSO mode that gives ordinary loads and stores x86 ordering, so Rosetta needs no barriers for them. Apple documents how Linux VMs can use the same mode for Rosetta (Virtualization framework, "Accelerating the performance of Rosetta"). Dougall Johnson notes that NVIDIA's Denver and Carmel and Fujitsu's A64FX also implement TSO.
ScarletNX now. Plain guest loads and stores are ordinary LLVM loads and stores at c->mem + address, volatile only
when the volatile_memory setting is on (default off). Ordered accesses are sequentially consistent LLVM atomics.
DMB ISHLD and DMB ISHST become acquire and release fences, and other barriers become full fences (ir_ldst.c,
ir_int.c, ir_state.c).
On each host. The guest's model is the weaker one only on x86-64, where LDAR costs a plain mov, STLR an
xchg and a full DMB an mfence. AArch64 has the guest's own model, and only DMB ISHST comes out stronger than it
needs (dmb ish). PowerPC64 is weaker than Arm, because it is not multi-copy atomic, and RISC-V's RVWMO is close to
Arm's. On every host but x86-64, the host CPU itself can reorder plain accesses, so an address dependency that LLVM
optimizes away could let a guest observe an order the console never shows. Fences cover the barriers, but only tests
can show what plain accesses do there.
dmb ishst for DMB ISHST on AArch64 hosts. Keep STLR as a sequentially consistent store on x86-64, because a
release store followed by LDAR must not reorder, and only revisit it if T2 shows STLR is hot. Examine whether
LLVM can split, duplicate or reorder a plain guest access in a way an Arm thread could observe, and use unordered
atomics for those accesses if it can.ir_ldst.c, ir_int.c, ir_state.c, new tests.tests/gnuabi_litmus.py runs store buffering, message passing, message passing with STLR and LDAR,
message passing with the split barrier DMB ISHST and DMB ISHLD, weak read coherence on three threads, and a plain
load in a spin loop, on the GNU ABI runtime, and tests/litmus/ has five of them in the herd7 format that derives
their expectations. Three tests carry it. gnuabi_litmus probes the build's C compiler and then clang for one
that emits an AArch64 object, and mold and then LLD by linking, rather than looking a name up on PATH, and uses
the first pair that builds the image. gnuabi_litmus_lld forces LLD, so both linkers are
covered where both are installed. gnuabi_litmus_self checks the driver's own decisions and needs no toolchain, so
it runs on every host, Windows and macOS included. Each Linux job installs Clang, LLD and mold for its tests, so
both linker paths run on x86-64 and AArch64.
The guest fixtures are registered under if (NOT WIN32), so Windows x86-64 or ARM64 runs the guest
half only once that registration leaves the block. Load buffering, IRIW, message passing with an address dependency,
and the dmb ishst and STLR fixes are not there yet.c->mem with no mask
(src/nx/memory/mem.c, ir_state.c), so a wild guest pointer past the reservation reaches host memory instead of
faulting as it would on the console.mem.c, ir_state.c, settings.txt.native_bench shows the mask's cost.Rosetta's translated code reaches guest data with no base register, because guest and host share one address space
(Dougall Johnson, on the memory layout). ScarletNX loads c->mem once per function and adds it to every guest address,
so one host register holds the base (ir_codegen.c, ir_state.c).
MAP_FIXED_NOREPLACE where the host's
address space allows, so the base is the constant 0. On Linux x86-64 the GS segment, through LLVM address space 256,
is a second way. Windows reserves GS for itself.mem.c, ir_state.c.native_bench and llvm-mca on hot loops first. Keep it only on hosts where the gain is clear. x86-64, with
its 16 registers, is where it can matter.Rosetta 2. attesor's README lists system call translation among Rosetta's parts, with the work of keeping register state across the call.
ScarletNX now. An SVC calls its own entry through RtAPI.svcs[imm] in a Switch module, with each SVC's registers in
the 64-bit and 32-bit ABIs generated by tools/svcgen from src/nx/hle/svc/hos.svc. The GNU ABI runtime accepts
SVC #0 and reads the Linux syscall number from x8 (docs/dev/architecture.md). To promotion an SVC is a call like any
other with no attributes, so it stores every dirty guest register before it and reloads every live one after it
(call_site in ir_promote.c).
On each host. The SVC path is IR and runtime C, the same on every host.
hos.svc as the starting point for register arguments and results, then audit the entire handler
path for context inspection, blocking, scheduler transitions, faults and callbacks. Encode an explicit effect
contract for each audited SVC. Narrow stores and reloads only when that contract proves them safe. The argument
list alone cannot prove this: a call with few arguments may expose the whole thread context while it blocks.
Context-changing, debug and unaudited calls remain full sites. Any path that needs the complete CPU state must
materialize it before runtime re-entry. In GNU ABI modules, use separate Linux effect contracts where x8 is known.ir_codegen.c, ir_promote.c, tools/svcgen.Rosetta 2. attesor's README lists CPU feature detection, thread-local storage and signal and exception handling.
ScarletNX now.
a64.profile, and the target's feature
set (the Switch's Cortex-A57 by default) decides which words are UNDEF (docs/dev/architecture.md). The guest sees the
console's CPU on every host.CPU and TLS (docs/dev/architecture.md, "Guest
exec").userfaultfd, and the runtime lands the page and
resumes the thread (src/nx/memory/own.c, src/nx/runtime/platform/plat_posix.c). A crash report has the registers
of the last call site (I1 adds the pc).clone returns ENOSYS
(docs/platforms/gnuabi/README.md).CPU structure holds the exact guest
state, and build an A64 signal frame from it. Synchronous faults in guest code need the pc map of I1, and stack maps
to rebuild the registers.src/gnuabi/, ir_codegen.c.scarletnx-gnuabi as they do under qemu-aarch64.The yuzu family runs guest code directly on AArch64 Android devices (NCE) and patches the instructions that need the
emulator, such as SVC and reads of the thread registers. For ScarletNX that would mean a new execution mode beside the
LLVM path: the guest space mapped at its own addresses, host pages of 4 KiB (Apple silicon uses 16 KiB pages, and many
ppc64le kernels use 64 KiB, per docs/hosts/apple.md and docs/hosts/ppc64.md), preemption by signal in place of polls, and
IC IVAU through page protection. The yuzu family's code is GPL-2.0-or-later and can be ported with its copyright lines
and an entry in docs/CREDITS.md. XL, P3, and a decision for the maintainers.
Before implementation, specify the Horizon SVC, TLS, scheduling, fault and code-invalidation paths from the OS boundary section. Validate them independently of instruction throughput. A matching instruction set does not supply a matching kernel ABI, and host signals alone do not prove that guest preemption is correct.
Rosetta 2. The oahd daemon translates outside the process and keeps the cache in a protected folder
(Champollion part 1). attesor's README adds that the translations are code-signed and that a debug server handles
translated processes.
ScarletNX now. The launcher and the driver recompile before play, and scarletnx -r and the recompiler library
(docs/dev/library.md) are the translation tools. Apple modules are Mach-O dylibs with an ad hoc signature. The GDB stub
(-S or -s) and gdb_jit debug a running game, and the JIT cache file is replaced through a rename
(jit_service.c).
oahd translates
apart from the program, and it builds only the units that changed. It says how many functions the last session found.src/nx/runtime/driver/recompile.c, the launcher in src/gui/.Made from docs/layers/cpu/plan.md at 69237645142c. GPL-3.0-or-later.