2 Commits
Author SHA1 Message Date
LibretroAdmin 34ee82678c new_dynarec: build and run the 32-bit x86 backend
i686 unix and mingw builds compile ari64 again. The x86 linkage
resumes at pcaddr each frame like the other backends, is assembled as
PIC on ELF, and reads its own generated asm_defines headers, which
`make asm-defines-regen` now refreshes for the backend being built.
The shared code no longer needs a scratch register on x86: a register
move cycle is broken with an exchange, the XKPHYS fold saves a
register around itself, and LL/SC pass their arguments on the stack.
The FPU C fallbacks pass the helpers the arguments they take.

The register move cycle on the scratch-register backends now moves
the blocked destination aside first instead of overwriting it.

check-cpu-fallback adds FPU moves and conversions, a loop keeping
eight registers live across interrupt checks, and LL/SC and LLD/SCD.
2026-10-29 04:58:26 +01:00
libretroadmin 71dc4e0c5d r4300: embed hot-state struct + code cache into r4300_core (region 14, Phase 2c)
Embeds struct new_dynarec_hot_state and the 32 MB JIT code cache (extra_memory)
into struct r4300_core, converging toward mupen64plus-next's layout; emits the
structural asm_defines offsets; fixes an arm64 name collision from the Phase-2a
struct; and stops the generated asm_defines headers from being regenerated on
every build (they are now committed source).

DORMANT: the x64 dynarec and its hand-written linkage still reference the flat
globals of the same name; nothing reads the embedded members yet. No runtime
behaviour change. The codegen/linkage repoint is Phase 2d.

  - r4300_core.h: add extra_memory[32MB] then new_dynarec_hot_state as members of
    struct r4300_core under #ifdef NEW_DYNAREC. extra_memory precedes the hot
    state so both sit in one BSS object inside g_dev and every RIP-relative
    displacement / rel32 call stays within +/-2GB, mirroring next. 32 MB is BSS
    (zero-cost until touched); savestates access g_dev field-by-field so the
    savestate format is unchanged.

  - asm_defines.c: emit the structural offsets (device->r4300,
    r4300_core->new_dynarec_hot_state at 0x2001000, r4300_core->extra_memory at
    0x1000).

  - arm64 collision fix (Phase-2a regression): struct members cpu_byte/cpu_hword
    and field 'address' collided with memory.h's flat externs (all targets) and
    arm64 RECOMPILER_MEMORY->rml_* macros, so the preprocessor rewrote those
    declarations and broke the arm64 build (only x86_64 had been compile-tested).
    Renamed to mem_address / hs_cpu_byte / hs_cpu_hword (offsets unchanged;
    next's asm_defines also exports the field as "mem_address").

  - build: the x64 asm_defines_{nasm,gas}.h headers are COMMITTED source and are
    NEVER regenerated by a normal build. The earlier rule made them depend on
    asm_defines.o, so every build regenerated them; on Windows the regeneration
    rewrote line endings (CRLF) against the committed LF versions, leaving the
    working tree permanently dirty and breaking "git am" with "does not match
    index". Regeneration is now an explicit, opt-in `make asm-defines-regen`
    target, run only when the struct layout changes. A .gitattributes marks the
    two headers -text so git never converts their line endings again. Removed the
    now-unused ASM_DEFINES_X64 marker from Makefile.common.

Verified on BOTH targets: x86_64 (NEW_DYNAREC=2) full sweep clean with the 23
hot_state offset asserts passing; aarch64 (NEW_DYNAREC=4) clean across
m64p_memory.c / r4300_core.c / device.c and the other r4300 TUs. Makefile parses;
a normal build performs zero asm_defines regeneration; headers are LF.
2026-06-17 02:54:47 +02:00