Commit graph

688 commits

Author SHA1 Message Date
Eladash b900c43ceb PPU: Precompile only encrypted executeables
Improve sys_prx_load_module and sys_overlay_load_module error checking.
2023-09-02 22:14:53 +03:00
Eladash deacf76ca4 PPU Analyzer: Revert TRAP detection change 2023-09-02 12:31:11 +03:00
Eladash a9810ccb72 SPU LLVM: Another fix for Game Collection's precompilation 2023-09-02 12:31:11 +03:00
Eladash 02b5cae2ad Precompile PRX/ELF extension 2023-08-30 16:47:45 +03:00
Elad Ashkenazi 105c5759f3 Add SPU Precompilation to Create PPU Cache 2023-08-30 08:45:29 +03:00
Eladash b5faf5800b SPU LLVM Precompilation
Implement function SPU function discovery in images or random SPU code
2023-08-28 09:03:56 +03:00
Megamouse 8772219492 Remove unused variable in PPUThread.cpp 2023-08-23 21:42:59 +02:00
Megamouse d8af3ea855 overlays: fix some warnings, simplify code, use move and references 2023-08-23 21:42:59 +02:00
Eladash a001e6ef09 Progress Dialog: Fix race on PPU compilation status 2023-08-22 05:40:53 +03:00
Eladash 7a0185dbcc PPU/debugger: Fixup 2023-08-21 14:36:54 +03:00
Eladash 17302a9422 Debugger/PPU: Superior Callstack Detection 2023-08-20 22:43:41 +03:00
Eladash dddd12f66b CELL: Postponed address notifications 2023-08-17 09:02:28 +03:00
Elad Ashkenazi 968762c135 Fix PPU SELF Precompilation 2023-08-14 18:47:20 +03:00
Eladash df24305698 PPU/Debugger: Fix op_branch_targets 2023-08-08 10:22:05 +03:00
Eladash cdc0441405 PPU: Fixup interpreter and analyzer 2023-08-08 10:22:05 +03:00
Eladash edf4f7eacc PPU/Patches: Fix CALLOC patch with interpreter 2023-08-07 19:01:38 +03:00
Eladash 39910885d9 PPU: fix leak when precompiling SELF files 2023-08-06 21:37:10 +03:00
Eladash 2a0278fbb1 Fixup SPU/PPU Cache Abortion 2023-08-06 21:37:10 +03:00
Eladash ee869a49f4 PPU Precompilation Fixup 2023-08-06 10:38:40 +03:00
Eladash 6547fa9cc3 PPU LLVM: Fixup VSH Precompilation 2023-08-06 08:26:17 +03:00
Eladash 4eaa03e9ba PPU: A few more minor bugfixes 2023-08-06 08:26:17 +03:00
Eladash d0b3891002 PPU LLVM Cache Fixup 2023-08-06 08:26:17 +03:00
trigger 0f3dfec7f2 direct return in ppu_check 2023-08-03 12:35:06 +03:00
Ivan Chikish d34287b2cc Linux: use futex_waitv syscall for atomic waiting
In order to make this possible, some unnecessary features were removed.
2023-08-02 21:46:06 +03:00
Talkashie dabb2cc9a0
Fix typos, improve consistency
Fixes typos where spelling or grammar is objectively wrong.
Changes wording and capitalization in some areas to be more consistent with other areas.
2023-07-28 13:09:06 +03:00
Eladash 782344eed8 Debugger: Make break-all non-default 2023-07-24 17:07:15 +03:00
Eladash 9d3e626b55 Minor ppu_initialize fix 2023-07-24 17:07:15 +03:00
Eladash a6e8b9037a ppu: Make install function log message trace 2023-07-24 17:07:15 +03:00
Eladash 9ff91c29f2 Invalidate Savestates 2023-07-23 17:58:54 +03:00
Eladash 1371bf89e0 PPU LLVM: Allow to abort OVL analysis in the middle 2023-07-15 08:26:28 +03:00
Eladash 3b8f8d7fc8 PPU LLVM: Improve precompilation time 2023-07-15 08:26:28 +03:00
Eladash c0280b43f2 PPU/Debugger: View the currently used CR field content in register panel 2023-07-12 13:22:06 +03:00
oltolm 0c94606fcf
Make compile with msvc, clang and gcc on Windows 2023-07-11 21:40:30 +03:00
Elad Ashkenazi e882d64d8a SPU/PPU Debugger: Add decimal mode to registers panel 2023-07-10 19:06:57 +03:00
Eladash 17d8f2884e Debug fixes 2023-07-09 13:33:03 +03:00
Eladash c21cdb8055 Implement PPU LV2 debug 2023-07-07 16:03:08 +03:00
Eladash 598fe85243 PPU LLVM/RawSPU: Implement MMIO violation elimination pass 2023-07-06 19:46:36 +03:00
Eladash 363e498462 Remove overlay hack for PPU LLVM OVL precompilation 2023-06-29 12:12:56 +03:00
Eladash a03dd44924 Empty kill and init callback before calling them 2023-06-29 12:12:56 +03:00
Eladash 554b27a82a PPU LLVM: Implement SELF precompilation
Do not use PS3 memory for precompilation.
2023-06-28 18:34:33 +03:00
Eladash 441fbd63bb Fix PPU debug setting with PPU interpreter 2023-06-20 18:18:24 +03:00
Megamouse d08fea551e progress dialog fix 2023-06-16 10:30:27 +02:00
Megamouse 16f869fe5a logging: minor trace optimizations 2023-06-15 19:48:15 +02:00
Megamouse c78c504043 overlays: update progress dialog workaround 2023-06-10 09:09:55 +02:00
Eladash c87a7cb2c0 PPU: Fix thread entry detection false positives 2023-06-09 14:07:37 +03:00
Eladash 6d918b565f PPU: Sleep after returning from thread entry function 2023-06-06 17:53:09 +02:00
Eladash d5eebd6ab4 debugger: Fix trailing spaces in PPU register dump 2023-06-06 09:48:27 +02:00
Eladash c37fc73a02 PPU LLVM: Invalidate cache for testers 2023-06-02 08:54:46 +03:00
Eladash b861a9c5d0 LV2: Implement set-priority thread requeue 2023-06-02 08:54:46 +03:00
Elad Ashkenazi db7f84f9f8
SPU/PPU/Debugger: Ensure ascending stack frames (#13833)
* PPU/Debugger: Ensure ascending stack frames

* SPU/Debugger: Ensure descending stack frame pointers
2023-05-10 11:23:09 +03:00
Elad Ashkenazi ead8e5e0c3 PPU LLVM: Unbreak function linkage 2023-05-07 14:11:37 +03:00
Ivan Chikish 22bd7dcc42 PPU LLVM: disable DSE pass and use volatile store/loads 2023-04-14 07:26:30 +03:00
Eladash 0e388639cc Loader: Make executable analyzation not halt UI when launching games 2023-04-12 15:18:50 +03:00
Ivan Chikish 06b0e35fb9 Update to LLVM 16.0.1
Fix Zen4+ AVX-512 detection
2023-04-11 12:13:09 +03:00
Ivan Chikish fb88e1c1c9 Update to LLVM 16.0.0, switch to upstream LLVM 2023-04-06 10:19:31 +03:00
oltolm 520524285a
llvm: update code to new API (#13500)
* llvm: update code to new API

* llvm: remove OLDLLVM define
2023-03-11 01:57:21 +03:00
Elad Ashkenazi e45e9c20dd
PPU: Do not break on unexpected TOC (#13490) 2023-03-09 16:53:44 +03:00
illusion0001 f2155b49e2
Debugger: show CIA in register view (#13462) 2023-02-28 00:30:23 +01:00
oltolm 40cd255051 fix: back() called an empty string in PPUThread.cpp 2023-02-26 22:20:07 +03:00
Eladash 3976018980 Debugger: Print error codes stored in GPR 2023-02-12 23:10:20 +01:00
brian218 53e906d0f3 sys_game: Implemented sys_game_board_storage_write() & Made it modifiable 2023-02-04 22:19:59 +01:00
brian218 49455965c0 sys_game: Implemented sys_game_get_rtc_status() & Updated sys_game_board_storage_read() 2023-01-26 15:52:45 +01:00
Elad Ashkenazi e6a7597444
PRX/savestates/VSH: Associate PRX with library, fix VSH browser (#13221)
* PRX/savestate:s Associate PRX with library

* VFS/Savestates: Fix host_root resolving

* Savestates: Fix segfault in ppu_initialize

* SPU: Avoid some log spam

* VSH/sys_vm: Fix limit on root processes
2023-01-15 23:12:54 +03:00
kd-11 3dba894369 rsx: Minor refactoring RSXThread
- Part 1 of many
2023-01-11 16:48:53 +03:00
Elad Ashkenazi 0946e5945f
VSH Improvements (#13172)
* sys_prx: Implement PRX LIB register syscall

* VSH: partial log spam fix

* sys_process reboot fix

* Implement sys_memory_container_destroy_parent_with_childs

* sys_net: Implement SO_RCVTIMEO/SO_SENDTIMEO

* VSH: Implement sys_rsx_context_free

* PPU LLVM: distinguish PPU cache exec also by address

Fixes referencing multiple PRX.

* UI: Do not report size of apps inside /dev_flash
2023-01-09 20:03:01 +03:00
Nekotekina 2f9cac8d18 fs: implement file::read_at
Reads from the given offset; does not seek; thread-safe.
2022-12-29 16:19:54 +03:00
Eladash 7df093c94b Make it work with LLVM
Allow multiple entries for a single code.
2022-12-09 21:16:05 +03:00
Eladash f572e29a13 PPU: Add new patch function for SONIC 06 2022-12-09 21:16:05 +03:00
Megamouse 3c79f3943f Minor simplifcation in ppu_finalize 2022-11-12 11:23:58 +03:00
Eladash b875a86e1d PRX: export functions on start() 2022-11-09 02:28:12 +03:00
Nekotekina ae809ad320 Unexpected bugfixes
Mostly unaligned memory access.
Also includes workarounds for ubsan execution.
2022-10-31 14:20:02 +03:00
brian218 5c24009eb5 Implemented sys_game_watchdog syscalls 2022-10-17 20:32:01 +03:00
brian218 e839595053 Implemented sys_game_get_system_sw_version() 2022-10-11 08:32:49 +02:00
Elad Ashkenazi 4d24ba1f35 PPU Precompilation: Abort compilation as soon as possible on Emu.Stop() 2022-10-06 12:23:51 +03:00
Eladash af8c871411 Add origin PRX names for log messages 2022-10-02 20:03:27 +03:00
Nekotekina 6ff6a4989a Implement at32() util
Works like .at() but uses source location for "exception".
2022-09-26 18:04:15 +03:00
Eladash 8485afa3a5 PPU debugger: report ppu_thread::ack_suspend state 2022-09-25 14:31:39 +03:00
Nekotekina b49a1f27eb Warning fixes 2022-09-17 16:35:02 +03:00
Eladash 92514e33bb Avoid reservation notifications in liblv2.sprx 2022-09-13 11:21:01 +03:00
Elad Ashkenazi 290226539f
Fix ARM build (#12606) 2022-09-04 21:11:04 +03:00
brian218 75efc79930 Implemented sys_game_board_storage_read() 2022-09-04 13:28:05 +03:00
Eladash 3f02935844 Add some debugging information 2022-08-30 08:57:33 +02:00
Nekotekina e28707055b Implement simd_builder for x86
ASMJIT-based tool for building vectorized loops (such as ones in BufferUtils.cpp)
2022-08-28 18:38:52 +03:00
Eladash 86702186f2 PPU: Detect lwmutex reservation pattern and optimize it 2022-08-21 15:02:01 +03:00
Eladash 1dd1062be1 PPU LLVM: Fix HLE function injection 2022-08-21 15:02:01 +03:00
sguo35 cc1e4d2194 ppu/arm64: don't restore rsp on ppu_gateway return
Don't restore rsp on ppu_gateway return, since it can be reentrant. Also
change some registers to align with the x86 version's 32bit/64bit
usages.
2022-08-05 22:53:11 +02:00
sguo35 2755d9941c ppu: fix a bug where arm64 sp wasn't being saved
ASMJIT can silently fail and drop instructions when invalid operations
are performed (e.g. loading/storing sp). Explicitly move sp to a gp
register before doing loads/stores to fix this.
2022-07-15 12:37:33 +03:00
Eladash 3e51426379 Savestates/SPU: Kill emulation when its safe to save SPU state 2022-07-15 09:30:53 +03:00
Eladash 155bd09fd0 Savestates: Cleanup v128 usage
It's compatible with bitwise serialization so it is faster to load/save it this way.
2022-07-06 19:43:25 +03:00
Eladash b692108f1e Savestates: HLE state saving POC in sys_lwmutex 2022-07-06 19:43:25 +03:00
Elad Ashkenazi fcd297ffb2
Savestates Support For PS3 Emulation (#10478) 2022-07-04 16:02:17 +03:00
Eladash 5e01ffdfd8 Debugger: Optimize cpu_thread::dump_regs()
Reuse string buffer. Copies and reallocations are expensive with such large strings.
2022-06-23 22:41:32 +02:00
Nekotekina 653a9e6e7f Debugger: always print cpu_thread::dump_misc()
Was removed for some reason.
2022-06-22 18:53:29 +03:00
sguo35 775caabeeb [ppu] Fix function trampoline for arm64
- Refactor function manager trampoline to be cleaner
- Add trampoline impl for arm64
- Force all JIT entrypoints on Apple to toggle W^X
2022-06-20 15:08:27 +03:00
Ivan c2190f71ca
SPU/PPU LLVM: fix triple setup (regression fix) (#12228) 2022-06-14 18:13:43 +03:00
Jeff Guo cefc37a553
PPU LLVM arm64+macOS port (#12115)
* BufferUtils: use naive function pointer on Apple arm64

Use naive function pointer on Apple arm64 because ASLR breaks asmjit.
See BufferUtils.cpp comment for explanation on why this happens and how
to fix if you want to use asmjit.

* build-macos: fix source maps for Mac

Tell Qt not to strip debug symbols when we're in debug or relwithdebinfo
modes.

* LLVM PPU: fix aarch64 on macOS

Force MachO on macOS to fix LLVM being unable to patch relocations
during codegen. Adds Aarch64 NEON intrinsics for x86 intrinsics used by
PPUTranslator/Recompiler.

* virtual memory: use 16k pages on aarch64 macOS

Temporary hack to get things working by using 16k pages instead of 4k
pages in VM emulation.

* PPU/SPU: fix NEON intrinsics and compilation for arm64 macOS

Fixes some intrinsics usage and patches usages of asmjit to properly
emit absolute jmps so ASLR doesn't cause out of bounds rel jumps. Also
patches the SPU recompiler to properly work on arm64 by telling LLVM to
target arm64.

* virtual memory: fix W^X toggles on macOS aarch64

Fixes W^X on macOS aarch64 by setting all JIT mmap'd regions to default
to RW mode. For both SPU and PPU execution threads, when initialization
finishes we toggle to RX mode. This exploits Apple's per-thread setting
for RW/RX to let us be technically compliant with the OS's W^X
    enforcement while not needing to actually separate the memory
    allocated for code/data.

* PPU: implement aarch64 specific functions

Implements ppu_gateway for arm64 and patches LLVM initialization to use
the correct triple. Adds some fixes for macOS W^X JIT restrictions when
entering/exiting JITed code.

* PPU: Mark rpcs3 calls as non-tail

Strictly speaking, rpcs3 JIT -> C++ calls are not tail calls. If you
call a function inside e.g. an L2 syscall, it will clobber LR on arm64
and subtly break returns in emulated code. Only JIT -> JIT "calls"
should be tail.

* macOS/arm64: compatibility fixes

* vm: patch virtual memory for arm64 macOS

Tag mmap calls with MAP_JIT to allow W^X on macOS. Fix mmap calls to
existing mmap'd addresses that were tagged with MAP_JIT on macOS. Fix
memory unmapping on 16K page machines with a hack to mark "unmapped"
pages as RW.

* PPU: remove wrong comment

* PPU: fix a merge regression

* vm: remove 16k page hacks

* PPU: formatting fixes

* PPU: fix arm64 null function assembly

* ppu: clean up arch-specific instructions
2022-06-14 15:28:38 +03:00
Elad Ashkenazi bda52a51a7
Debugger: Show HEX view of floating-point PPU registers 2022-05-31 07:36:10 +02:00
Eladash 56f95934f5 Fix cellVdec regression to be harmonized with the new interrupts model 2022-05-25 17:36:28 +03:00
Eladash 961d41d0bd RawSPU: Reinvoke pending interrupts if missed 2022-05-25 11:46:51 +03:00
Elad Ashkenazi 5a581f46df Add a constraint about vm area approx matching 2022-05-19 21:29:18 +03:00