Commit graph

398 commits

Author SHA1 Message Date
Eladash 2807be7080 SPU: Regression fix after #12648 2022-09-13 20:11:30 +03:00
kd-11 0d9b1654ec asm: Avoid ALU instructions on busy wait cycles 2022-09-09 23:17:27 +03:00
Eladash 28bec8e1bf SPU: Implement custom reservation condition in atomic wait 2022-08-21 15:02:01 +03:00
Nekotekina b6608ad31d vm_native: rewrite win7 workaround 2022-08-15 12:26:17 +03:00
Nekotekina 7bb2d94e53 vm: use sparse files to emulate overcommit memory
Fix shm::map_critical page flags.
2022-08-12 13:59:03 +03:00
Eladash 34bae90820 LV2: Move nearly all notifications out of all mutex scopes including IDM 2022-08-07 20:23:54 +03:00
Megamouse 3d73915358 cellSearch: improve populate_photo_info, read image headers 2022-07-26 17:27:35 +02:00
Megamouse c40439ae6b cellMusic/Decode: implement playlist shuffle and repeat 2022-07-22 08:42:43 +02:00
sguo35 9e57efe82c spu: implement assembly functions for arm64 2022-07-15 12:37:33 +03:00
sguo35 086e12c6ca mac: mmap calls should initialize with r/w page perms
Mac/Arm64 pages should be R/W by default due to 16k page
incompatibility. Without this there will be segfaults due to invalid
permissions.
2022-07-15 12:37:33 +03:00
sguo35 9b19f16698 arm64: add optimized 16byte ld/st for armv8.4a+
16B ldp/stp are atomic on v8.4a+. See Arm Architecture Reference Manual,
"Changes to single-copy atomicity in Armv8.4". Add load/release atomic
impls for this instruction and add detection for 8.4a+ capability.
2022-07-15 12:37:33 +03:00
Eladash ab27ee4cf4 Savestates/RSX: Save NV406E semaphore waiting 2022-07-12 15:15:42 +03:00
Eladash 6211295155 atomic.hpp: Truncation warning fix 2022-07-12 15:15:42 +03:00
Eladash 219e3d61f8 Minor fix in shm::map_critical 2022-07-10 14:19:59 +03:00
Nekotekina 786510a937 Use gettid() on Linux, don't use std:🧵:id
pthread_self() returns a large opaque pointer which is harder to use.
2022-07-10 12:22:28 +03:00
Nekotekina 4b787b22c8 Implement FN (lambda shortener)
Useful for some higher order functions.
Allows to make short lambdas even shorter.
2022-07-08 14:47:41 +03:00
Nekotekina 5c6f5a1610 Cleanse LOG_CONSTINIT macro
Should be unnecessary.
2022-07-08 14:47:41 +03:00
Eladash 4ac88fa8d3 Savestates/RSX: Save drawing context 2022-07-08 12:57:43 +03:00
Eladash 5f8f9e33f1 RSX/Savestates: Replace GCM hack with a proper fix 2022-07-08 12:57:43 +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 71e07dc6c7 IdManager.h: Improvements
* Ensure ::PtrSame<T, Derived> is true.
* Allow id_base, id_step and id_count to be of enumeration type.
* Fix potential deadlock in kernel explorer.

idm::select:
* Allow to select multiple inherited object types for idm::select.
* Allow function reference types. (they don't allow access to operator() directly, use deducing std::function constructor instead)
* Ensure ::is_same_ptr<T, object_type> is true.
2022-06-22 17:24:47 +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 1738b38536
vm_native.cpp: Use Windows 10 memory mapping API (the correct API) 2022-06-10 14:27:02 +03:00
Nekotekina b0ccd2a8a0 Implement utils::c_page_size (unused)
Query platform memory page size.
2022-06-02 12:56:49 +03:00
Megamouse 88ee62be26
cellAdec: fix uninitialized default size of AVPacketHolder (#12077) 2022-05-25 11:40:51 +02:00
Nekotekina 0a5ea859ea atomic.cpp: fix race in cond_id_lock() 2022-05-07 21:25:38 +03:00
Nekotekina cd6aa0774f Reduce stack usage in atomic_wait_engine::notify_all 2022-04-24 13:26:28 +03:00
Nekotekina 6d3052c5dd Optimization: disable atomic_wait_engine notify callback for SPU
Disable placebo callback calls in notify_all.
Don't use callback at all if TSX.
Based on kd-11 findings.
2022-04-24 13:15:54 +03:00
Megamouse f42e647430 cellVdec: use av_error_to_string 2022-04-21 22:22:33 +02:00
Megamouse d8bbec9594 libav: log more error codes as string 2022-04-21 08:10:01 +02:00
sguo35 e761b3235c macos: fix build for arm64
Adds arm64 branches to some x86 specific code and modifies some casting
logic to make Clang happy
2022-04-18 17:53:54 +03:00
Timo654 afae58b231 Interpret negative values in game patches 2022-04-18 17:01:19 +03:00
Megamouse 499fe3e218 Patch manager: add node location to patch errors 2022-04-09 21:26:06 +02:00
RipleyTom a4d715e25d Warning Fixes 2022-03-23 19:35:10 +01:00
Megamouse 539ac32806 Decrease log spam in case that per core cpu usage cannot be queried 2022-03-18 01:47:23 +01:00
Megamouse e58906cb4d cpu_stats: fmt::win_error_to_string 2022-03-16 22:20:23 +01:00
Megamouse 04df392866 Log cpu usage periodically 2022-03-16 19:42:06 +01:00
nastys ce7b1576e0 Low Power Mode detection
Change low to reduced

Low Power Mode detection

Fix namespace space

Low Power Mode detection

Fix namespace space

Low Power Mode detection
2022-03-14 08:28:02 +01:00
Megamouse aafd74f9ea cellMusicDecode: initial implementation
Implements the basic functionality of cellMusicDecode.
Works with Space Invaders (if you add the list selection from the other PR).
Probably fixes SSX custom music.
2022-03-05 18:34:27 +01:00
Megamouse 15e74357cf cellMusic: implement qt music handler 2022-03-03 08:25:46 +01:00
Megamouse b1a9e87ecf cellSearch: fix cellSearchStartListSearch
Fixes listing BGM in Gundam.
The returned content was always empty.
Playback of the tracks will still require a MusicSelectionContext and cellMusic playback, which isn't implemented yet.
2022-02-20 21:06:46 +01:00
Nekotekina dba2baba9c Implement utils::memory_map_fd (partial)
Improve JIT profiling dump format (data + name, mmap)
Improve objdump interception util (better speed, fix bugs)
Rename spu_ubertrampoline to __ub+number
2022-01-26 15:46:16 +03:00
Nekotekina 12c83b340d Remove built_function
With today's branch prediction techniques, it's hardly useful.
2022-01-24 22:21:41 +03:00
Nekotekina a4d94a83b9 PPU/simd.hpp: minor changes in DP instructions 2022-01-21 13:57:46 +03:00
Nekotekina 628354ba92 Use global variable in gv_zeroupper 2022-01-20 21:16:00 +03:00
Nekotekina 8c3fb3998c PPU: fix crash on SSE41 CPU in internal builder 2022-01-20 14:42:58 +03:00
Nekotekina d572d90bb7 PPU: fixup for old CPU
Abort building interpreter function when out of registers.
2022-01-20 08:31:08 +03:00
Nekotekina b42fae0989 PPU: refactor shift and splat instructions
Fix utils::rol32/64 functions.
Fix immediate clamping in splat instructions.
Other fixes.
2022-01-19 23:01:31 +03:00
Nekotekina 08b02efc6c ARM: don't calibrate TSC, use cntfrq_el0 info 2022-01-18 04:21:42 +03:00