Commit graph

584 commits

Author SHA1 Message Date
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
Eladash b334621d76 PPU DisAssembler: Prevent false function descriptor detection 2022-05-19 21:29:18 +03:00
Elad Ashkenazi a768855a7a Update PPUThread.cpp 2022-05-19 18:16:53 +03:00
Eladash a2a6303a22 PPU LLVM: Precompile system-internal executables if booting a dev_flash's program 2022-05-12 19:55:07 +03:00
Eladash d77c9139ad Debugger: Show constant-formed attribute of register value 2022-05-10 22:34:29 +03:00