Commit graph

206 commits

Author SHA1 Message Date
RipleyTom cd87a64621 Headers cleanup 2025-02-11 20:38:35 +01:00
Elad 575a245f8d
IDM: Implement lock-free smart pointers (#16403)
Replaces `std::shared_pointer` with `stx::atomic_ptr` and `stx::shared_ptr`.

Notes to programmers:

* This pr kills the use of `dynamic_cast`, `std::dynamic_pointer_cast` and `std::weak_ptr` on IDM objects, possible replacement is to save the object ID on the base object, then use idm::check/get_unlocked to the destination type via the saved ID which may be null. Null pointer check is how you can tell type mismatch (as dynamic cast) or object destruction (as weak_ptr locking).
* Double-inheritance on IDM objects should be used with care, `stx::shared_ptr` does not support constant-evaluated pointer offsetting to parent/child type.
* `idm::check/get_unlocked` can now be used anywhere.

Misc fixes:
* Fixes some segfaults with RPCN with interaction with IDM.
* Fix deadlocks in access violation handler due locking recursion.
* Fixes race condition in process exit-spawn on memory containers read.
* Fix bug that theoretically can prevent RPCS3 from booting - fix `id_manager::typeinfo` comparison to compare members instead of `memcmp` which can fail spuriously on padding bytes.
* Ensure all IDM inherited types of base, either has `id_base` or `id_type` defined locally, this allows to make getters such as `idm::get_unlocked<lv2_socket, lv2_socket_raw>()` which were broken before. (requires save-states invalidation)
* Removes broken operator[] overload of `stx::shared_ptr` and `stx::single_ptr` for non-array types.
2024-12-22 20:59:48 +02:00
oltolm 2b0f786b2d
Fix std::basic_string warnings (#16261) 2024-11-11 21:54:44 +02:00
Elad Ashkenazi e58a3ab7e0 sys_spu: Fix order of some checks 2024-10-15 10:42:22 +03:00
Elad Ashkenazi e0e1c729cd Fix sys_spu_thread_group_disconnect_event 2024-10-15 10:42:22 +03:00
Elad Ashkenazi 7c6b558647 Improve sys_spu_thread_initialize 2024-10-15 09:36:36 +03:00
Elad Ashkenazi f6c585902a sys_spu: Fix SPU queue index type 2024-10-14 20:15:14 +03:00
Elad Ashkenazi 693cf9950f sys_spu: Minor fixes 2024-10-14 20:15:14 +03:00
Elad Ashkenazi d51d5ce86d SPURS limiter tweaks 2024-10-07 15:02:23 +03:00
Elad Ashkenazi 8b79fd3da1 SPU: Make SPURS limit a dynamic setting 2024-09-26 06:59:20 +03:00
Elad Ashkenazi ad42a2b89a SPU: Task-based SPURS limiter 2024-09-24 10:31:37 +03:00
Ani 02362a4807 spu: Do not apply a Max SPURS Threads limit to libSail
On all the tested games (e.g. Naruto Ultimate Ninja Storm, Catherine),
limiting SPURS threads for "_libsailCellSpursKernelGroup" causes video
playback to hang and the game to permanently freeze. These games still
function properly while limiting the other CellSpursKernelGroup groups,
as I've confirmed through manual thread pausing.

I have not found a single example that shows that 
_libsailCellSpursKernelGroup threads can be limited without the game 
freezing.

This allows the Max SPURS Threads setting to work with more games, or to 
work with a lower thread limit count for games where it already works.
2024-09-21 15:02:41 +02:00
Elad Ashkenazi d0ebba6c5e CELL: New reservation notifications mechanism 2024-08-14 11:53:00 +03:00
Elad Ashkenazi 77e8f9a8ab SPU: Utilize Operating System sleep in detected RCHCNT loop 2024-07-19 14:31:19 +03:00
Eladash f0c93ae9dc sys_spu: Fix warning and theoretical bug 2024-01-01 11:58:00 +02:00
Eladash 526aaf7302 Fix idm::allocate_id at fixed position 2023-12-29 11:11:53 +02:00
Eladash f60bdbaece Savestates: Compressed state files 2023-11-27 12:36:17 +02: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
Eladash 9fc5f6271b Update SPU reservation notifier mask 2023-07-23 17:58:54 +03:00
Eladash 9ff91c29f2 Invalidate Savestates 2023-07-23 17:58:54 +03:00
Eladash 083b4f0d3b Patches: Fix potential RPCS3 crashes due to invalid patches 2023-07-13 07:38:46 +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 b861a9c5d0 LV2: Implement set-priority thread requeue 2023-06-02 08:54:46 +03:00
Elad Ashkenazi 5cf80c05a5 savestates:/sys_spu: Fix join saving 2023-04-28 16:13:15 +03:00
Megamouse cd9ff08235 Decrease some include madness 2023-04-26 21:37:44 +02:00
Margen67 5bb89328d0 Remove whitespace 2023-02-15 08:58:02 +01: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
Eladash 87797e117e sys_spu: Some more fixes of wait flag misuse 2022-10-16 20:55:36 +03:00
Elad Ashkenazi cb743da215 sys_spu: fixup raw spu destroy regression
Caused a missed cpu_thread::state notification which is required now.
2022-10-06 12:23:51 +03:00
Eladash d25d1ecb3a LV2: Avoid using multi-variable atomic waiting on cpu_thread::state wait 2022-10-04 16:28:34 +03:00
Eladash 194f7375da SPU/LV2: Fix tiny race conditions 2022-09-21 20:35:34 +03:00
Eladash cfdc852f03 SPU: Power consumption reduction when using SPU inaccurate reservations 2022-09-13 11:21:01 +03:00
Eladash 48382564d1 SPU: Implement "quintuple" Inbound MBOX storage 2022-09-07 20:42:23 +03:00
Eladash 7698064f5a SPU: Untangle VM lock to avoid deadlocks 2022-09-07 16:05:56 +03:00
Eladash 34bae90820 LV2: Move nearly all notifications out of all mutex scopes including IDM 2022-08-07 20:23:54 +03:00
Eladash c7fbc16357 SPU: Postpone notifications to afterward group mutex ownership 2022-08-07 20:23:54 +03:00
Eladash 2eebbd307d LV2: Minor optimization regarding signal flag 2022-08-07 20:23:54 +03:00
Eladash 12ebf77e22 Savestates: save sys_spu_initialize settings 2022-07-19 10:43:51 +03:00
Eladash cdd6840826 Savestates/SPU: Complete fix for saving sys_spu_thread_receive_event 2022-07-12 15:15:42 +03:00
Eladash befd7ceb89 Savestates/sys_spu: Minor fix in saving sys_spu_thread_receive_event 2022-07-10 14:19:59 +03:00
Elad Ashkenazi fcd297ffb2
Savestates Support For PS3 Emulation (#10478) 2022-07-04 16:02:17 +03:00
RipleyTom da6434a65a
Implements sys_fs_fcntl 0xC0000008 & 0xC000001A (#11957) 2022-06-11 13:12:42 +01:00
Eladash 27b28cf6ec sys_spu: Fix spu_thread_group_terminate deadlock 2022-05-26 18:04:52 +03:00
Eladash f9a62667cf SPU/PPU Loader: Implement linker/PS3 compiler executable files loading 2022-05-03 20:47:36 +03:00
Eladash 0ab36ef44d
sys_spu: Implement SPU image segment info checks (#11211) 2021-12-02 13:17:10 +03:00
Eladash c49ebba648 Fixes of PS3 filesystem EDAT/SDAT handling
* Return EFSSPEIFIC if encountered corrupted EDAT or an unmatched key in sys_fs_open and sys_fs_read.
* Fix validate_dev_klic() for license-free EDAT.
* Fix EDATADecrypter::ReadData() for when size + pos > file_size but pos < file_size.
* Try to save up to 16 decryption keys. Educated guess based on NPDRM file descriptors count llimit.
* Return LICENCE_NOT_FOUND if needed RAP file is not found in sceNpDrmIsAvailable.
* Check additional sys_fs_open errors for sceNpDrmOpen. (EISDIR, ENOTMOUNTED)
2021-11-04 21:32:15 +03:00
Eladash dfbc49513d Debugger/Disasm: Name SPU Syscalls 2021-09-07 01:13:57 +02:00
Eladash 6781373727
Patch cooperate with system SPU group creation (#10791) 2021-08-29 22:03:17 +03:00
Eladash 91737b11fe Fix sys_spu_thread_group_resume
Do not remove suspend flag when SPU group state is not SPU_THREAD_GROUP_STATUS_RUNNING after operation!
2021-08-12 22:24:54 +03:00
Eladash 9ecb6c4e34 Fix sys_spu_thread_group_create 2021-08-05 08:12:34 +03:00