Commit Graph

109 Commits

Author SHA1 Message Date
Christopher Hotchkiss
42242b3c43 SPU Analyzer: fix wrong divisor in Giga const-prop re-decode
The "Fill more block info" re-decode indexed result.data[(ia - lsa) / 41] instead of / 4 (its companion decode uses / 4), so it read the wrong word and corrupted the per-block reg_const / reg_val32 constant propagation.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 02:00:35 +03:00
Christopher Hotchkiss
064365d6fb SPU Analyzer: prune dead in-range targets from m_targets (Giga)
Giga cleanup clears m_block_info for removed blocks but left their in-range edges in m_targets, so the register-state walk dereferenced a stale target and aborted ("Range check failed") - e.g. a brsl whose return is a stop-trap, hit in Skylanders Giants. Prune those edges at the m_targets cleanup; export out_target_list after the prune so callers see the cleaned map; keep the initiate_patterns and cond_next-walk guards as defense in depth.

Adds made-up-data regression tests (the exported-map test fails without the prune) and the rpcs3_test.vcxproj entry.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 02:00:35 +03:00
Elad
e379fba97d SPU/PPU: Implement PPU reservation priority over SPUs 2026-06-07 23:30:05 +03:00
Malcolm
a87d175295 SPU LLVM: Retry ARM64 TBL2 register scavenger failures
- Some SPU programs inexplicably fail to compile when TBL2/TBX2 are used.
- As an insane workaround, first try to compile with TBL2/TBX2, if LLVM crashes while compiling, try to compile the same program without TBL2/TBX2.
2026-05-27 02:46:11 +03:00
Megamouse
4cc0e4c7fc spu_recompiler: Initialize members 2026-05-14 17:12:25 +02:00
Megamouse
f5c420994d Add unsafe bit_set access for obvious cases 2026-05-14 17:12:25 +02:00
Megamouse
c5ee48f54a Harden bitset access 2026-05-14 17:12:25 +02:00
Elad
53d76db753
SPU: More UB fixes 2026-05-14 13:21:23 +03:00
Elad
c860aa2107 SPU Analyzer: Fix initiate_patterns function 2026-05-14 10:42:20 +03:00
Elad
ee436307cf SPU Update 2026-05-14 10:42:20 +03:00
AurisDSP
6850e2e5a8 Apple Silicon: consolidate JIT W^X handling with RAII guards
Address review feedback on #18701 (cc @elad335): combine the SPU
worker fix from #18701, the SPRX Loader fix from #18703, and three
additional similar W^X leaks discovered while auditing the codebase
for the same pattern. Use Allman-style braces to match RPCS3 coding
style.

Background:
On AArch64 Apple Silicon, MAP_JIT pages enforce W^X per-thread.
pthread_jit_write_protect_np(false) enables write mode and
pthread_jit_write_protect_np(true) restores execute mode. When code
takes an early return or throws between these calls, the thread is
left in write mode, which can cause segfaults on subsequent code
fetches or inconsistent state at thread teardown.

Fixes applied (all gated on __APPLE__):

1. Emu/Cell/SPUCommonRecompiler.cpp - SPU cache worker thread
   Add RAII guard so execute mode is restored on worker exit.

2. Emu/System.cpp - SPRX Loader thread
   Enter write mode (was missing entirely) so ppu_initialize() and
   ppu_precompile() can write to MAP_JIT pages, and pair with an
   RAII guard. Reproducer: Red Dead Redemption (BLUS30418) crashes
   ~12s into boot at 0x300010000 without this fix.

3. Emu/Cell/SPULLVMRecompiler.cpp - SPU LLVM compile path
   The compile function enters write mode, then has an early
   "return nullptr" path on rebuild_ubertrampoline failure that
   skipped the explicit restore. Add RAII guard so execute mode
   is restored on every exit path. The existing explicit restore
   before the cache-flush asm directives is preserved.

4. Emu/Cell/PPUThread.cpp - PPU LLVM worker thread (operator())
   Worker entered write mode but never restored it on operator()
   return. Add RAII guard.

5. Emu/Cell/PPUThread.cpp - ppu_initialize() main path
   This scope alternates write/execute mode and contains an early
   "return compiled_new" at the empty-jits check plus a final
   return that both leak write mode. Add RAII guard so execute
   mode is always restored on exit. Intermediate explicit
   transitions for the symbol-resolver invocation are preserved.

No behavioral change on x86_64 or non-Apple ARM64 (all changes are
inside #ifdef __APPLE__ / #if defined(__APPLE__)).

Supersedes #18703.
2026-05-09 15:07:22 +03:00
Megamouse
a8dd053593 Fix some warnings 2026-04-30 20:41:35 +02:00
Elad
80b6faef10 SPU Analyzer: Add some logging 2026-04-22 09:59:14 +03:00
Megamouse
c340eb2f17 Remove nop loop 2026-04-14 11:53:41 +02:00
Megamouse
e43435e152 Remove unused should_have_argument_increment 2026-04-14 11:53:41 +02:00
Megamouse
426f3c445b Remove some unused variables 2026-04-14 11:53:41 +02:00
Elad
02eb549208 SPU LLVM: Fix register updates in second block of Reduced Loop 2026-04-03 18:33:07 +03:00
Elad
13de8233b0 SPU Analyzer: Fix register origin for Reduced Loop 2026-04-03 18:33:07 +03:00
Elad
a03a78dbd2 SPU: Verify SPU Reduced loop completability 2026-04-03 18:33:07 +03:00
Elad
ac104a519e SPU Analyzer: More fix 2026-03-31 21:56:30 +02:00
Elad
80f972cd38 SPU Analyzer: Acknowledge unknown targets 2026-03-31 02:12:40 +02:00
Elad
615f416af3 SPU Anlyzer: Verify bitset index 2026-03-31 02:12:40 +02:00
Elad
a4523651c7 RPCS3: Notify RAM shortage, Log current and peak RAM usage 2026-03-27 20:20:29 +03:00
Elad
37a07ae545 SPU LLVM: Optimize FM, FMA and FCGT in Reduced Loop 2026-03-26 13:55:00 +02:00
Elad
e1eae3ee49 Add floating ppoint hint 2026-03-26 13:55:00 +02:00
Elad
2e4ee9c9b6 SPU LLVM: Implement reduced loop 2026-03-26 13:55:00 +02:00
Elad
a863e94c25 SPU: Detect reduced loop 2026-03-26 13:55:00 +02:00
Elad
45c6e938a5 SPU LLVM: Expand SPU Profiling to blocks 2026-02-28 10:58:25 +02:00
Elad
1ec3de9e8f SPU Analyzer: Fix analysis of instructions without regmod 2026-02-28 10:58:25 +02:00
Elad
188151fa99 SPU/misc: Remove outdated Instruction statistics 2026-02-28 10:58:25 +02:00
Elad
e0cdafddb5 SPU Analyzer: Fix missing jump table entries in Mega mode 2025-12-16 23:20:37 +00:00
Megamouse
27f39d2ac0 fmt: add more string_view versions of string functions 2025-12-08 19:49:42 +01:00
Elad
4bda2f9b0f Test: Disable PUTLLC0
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux-aarch64.sh, gcc, rpcs3/rpcs3-ci-jammy-aarch64:1.7, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux.sh, gcc, rpcs3/rpcs3-ci-jammy:1.7, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (a1d35836e8d45bfc6f63c26f0a3e5d46ef622fe1, rpcs3/rpcs3-binaries-linux-arm64, /rpcs3/.ci/build-linux-aarch64.sh, clang, rpcs3/rpcs3-ci-jammy-aarch64:1.7, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (d812f1254a1157c80fd402f94446310560f54e5f, rpcs3/rpcs3-binaries-linux, /rpcs3/.ci/build-linux.sh, clang, rpcs3/rpcs3-ci-jammy:1.7, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (51ae32f468089a8169aaf1567de355ff4a3e0842, rpcs3/rpcs3-binaries-mac, .ci/build-mac.sh, Intel) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (8e21bdbc40711a3fccd18fbf17b742348b0f4281, rpcs3/rpcs3-binaries-mac-arm64, .ci/build-mac-arm64.sh, Apple Silicon) (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Build RPCS3 / RPCS3 Windows Clang (win64, clang, clang64) (push) Waiting to run
Build RPCS3 / RPCS3 FreeBSD (push) Waiting to run
2025-11-30 18:31:50 +02:00
Elad
d822d85ea1 SPU: Tame PUTLLC16 2025-11-30 18:31:50 +02:00
Elad
7001940483 SPU Analyzer: Be more strict with loads 2025-11-30 18:31:50 +02:00
Elad
3c5c74c496 SPU Cache debug 2025-11-30 18:31:50 +02:00
Elad
e938b93f48 SPU Analyzer: Ignore large switch state
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux-aarch64.sh, gcc, rpcs3/rpcs3-ci-jammy-aarch64:1.7, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux.sh, gcc, rpcs3/rpcs3-ci-jammy:1.7, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (a1d35836e8d45bfc6f63c26f0a3e5d46ef622fe1, rpcs3/rpcs3-binaries-linux-arm64, /rpcs3/.ci/build-linux-aarch64.sh, clang, rpcs3/rpcs3-ci-jammy-aarch64:1.7, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (d812f1254a1157c80fd402f94446310560f54e5f, rpcs3/rpcs3-binaries-linux, /rpcs3/.ci/build-linux.sh, clang, rpcs3/rpcs3-ci-jammy:1.7, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (51ae32f468089a8169aaf1567de355ff4a3e0842, rpcs3/rpcs3-binaries-mac, .ci/build-mac.sh, Intel) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (8e21bdbc40711a3fccd18fbf17b742348b0f4281, rpcs3/rpcs3-binaries-mac-arm64, .ci/build-mac-arm64.sh, Apple Silicon) (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Build RPCS3 / RPCS3 Windows Clang (win64, clang, clang64) (push) Waiting to run
Build RPCS3 / RPCS3 FreeBSD (push) Waiting to run
2025-11-29 20:17:21 +02:00
Elad
c48ae344a8 SPU LLVM (Mega): Fix quarter of missing jumptable discoveries 2025-11-29 17:10:30 +02:00
Elad
14bd6b0cc5 SPU: Enable PUTLLC16 by default
Experimental, may be reduced to specific patterns instead of being enabled globally.
2025-11-29 07:30:39 +02:00
Elad
e2da6d36ba SPU LLVM: Permit relative-PC in PUTLLC16 with alignment check 2025-11-29 07:30:39 +02:00
Elad
27c2f2ae4d SPU Analyzer: Contnue with failed patterns until they proven failure 2025-11-29 07:30:39 +02:00
Elad
727f3dd7a1 SPU Analyzer: Try to detect no-return in BISL/BRSL 2025-11-29 07:30:39 +02:00
Elad
89a13b75f7 SPU Analyzer: Fix jumptable append
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux-aarch64.sh, gcc, rpcs3/rpcs3-ci-jammy-aarch64:1.7, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux.sh, gcc, rpcs3/rpcs3-ci-jammy:1.7, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (a1d35836e8d45bfc6f63c26f0a3e5d46ef622fe1, rpcs3/rpcs3-binaries-linux-arm64, /rpcs3/.ci/build-linux-aarch64.sh, clang, rpcs3/rpcs3-ci-jammy-aarch64:1.7, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (d812f1254a1157c80fd402f94446310560f54e5f, rpcs3/rpcs3-binaries-linux, /rpcs3/.ci/build-linux.sh, clang, rpcs3/rpcs3-ci-jammy:1.7, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (51ae32f468089a8169aaf1567de355ff4a3e0842, rpcs3/rpcs3-binaries-mac, .ci/build-mac.sh, Intel) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (8e21bdbc40711a3fccd18fbf17b742348b0f4281, rpcs3/rpcs3-binaries-mac-arm64, .ci/build-mac-arm64.sh, Apple Silicon) (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Build RPCS3 / RPCS3 Windows Clang (win64, clang, clang64) (push) Waiting to run
Build RPCS3 / RPCS3 FreeBSD (push) Waiting to run
2025-11-23 21:00:11 +02:00
Elad
7472d95b0c SPU Analyzer: Fix jumptable analysis for SPU Block Mega 2025-11-23 21:00:11 +02:00
oltolm
0439b62257
SPU Analyzer: use std::lexicographical_compare_three_way
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux-aarch64.sh, gcc, rpcs3/rpcs3-ci-jammy-aarch64:1.7, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux.sh, gcc, rpcs3/rpcs3-ci-jammy:1.7, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (a1d35836e8d45bfc6f63c26f0a3e5d46ef622fe1, rpcs3/rpcs3-binaries-linux-arm64, /rpcs3/.ci/build-linux-aarch64.sh, clang, rpcs3/rpcs3-ci-jammy-aarch64:1.7, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (d812f1254a1157c80fd402f94446310560f54e5f, rpcs3/rpcs3-binaries-linux, /rpcs3/.ci/build-linux.sh, clang, rpcs3/rpcs3-ci-jammy:1.7, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (51ae32f468089a8169aaf1567de355ff4a3e0842, rpcs3/rpcs3-binaries-mac, .ci/build-mac.sh, Intel) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (8e21bdbc40711a3fccd18fbf17b742348b0f4281, rpcs3/rpcs3-binaries-mac-arm64, .ci/build-mac-arm64.sh, Apple Silicon) (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Build RPCS3 / RPCS3 Windows Clang (win64, clang, clang64) (push) Waiting to run
Build RPCS3 / RPCS3 FreeBSD (push) Waiting to run
It should compile now because we upgraded Linux CI.
2025-11-16 22:57:16 +02:00
oltolm
a93197cdcb asm.hpp: replace custom functions with C++20 functions 2025-11-16 20:05:00 +02:00
Elad
3e701a743b Win32/SPU: Respect home space / shadow space on the stack frame
Some checks failed
Generate Translation Template / Generate Translation Template (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux-aarch64.sh, gcc, rpcs3/rpcs3-ci-jammy-aarch64:1.6, ubuntu-24.04-arm) (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux.sh, gcc, rpcs3/rpcs3-ci-jammy:1.6, ubuntu-24.04) (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (a1d35836e8d45bfc6f63c26f0a3e5d46ef622fe1, rpcs3/rpcs3-binaries-linux-arm64, /rpcs3/.ci/build-linux-aarch64.sh, clang, rpcs3/rpcs3-ci-jammy-aarch64:1.6, ubuntu-24.04-arm) (push) Has been cancelled
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (d812f1254a1157c80fd402f94446310560f54e5f, rpcs3/rpcs3-binaries-linux, /rpcs3/.ci/build-linux.sh, clang, rpcs3/rpcs3-ci-jammy:1.6, ubuntu-24.04) (push) Has been cancelled
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (51ae32f468089a8169aaf1567de355ff4a3e0842, rpcs3/rpcs3-binaries-mac, arch -X86_64 .ci/build-mac.sh, Intel) (push) Has been cancelled
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (8e21bdbc40711a3fccd18fbf17b742348b0f4281, rpcs3/rpcs3-binaries-mac-arm64, .ci/build-mac-arm64.sh, Apple Silicon) (push) Has been cancelled
Build RPCS3 / RPCS3 Windows (push) Has been cancelled
Build RPCS3 / RPCS3 Windows Clang (win64, clang, clang64) (push) Has been cancelled
Build RPCS3 / RPCS3 FreeBSD (push) Has been cancelled
2025-09-19 12:28:51 +03:00
kd-11
4f7c82ba8a utils: Rename address_range to address_range32 to allow implementation of address_range16 and address_range64 2025-05-27 15:06:32 +03:00
Vestral
3cebfaa648
Atomic utils fixup after ASLR changes (#17168) 2025-05-05 21:48:07 +03:00
Vestral
e110334c2c Disable SPU asmjit on ARM. Only supported on x86 2025-04-30 02:56:23 +02:00