Commit graph

97 commits

Author SHA1 Message Date
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
Megamouse
dfee5b9a6c threads: replace magic number id_type with thread_class 2024-05-18 16:16:08 +02:00
Eladash
68349e48cd Savestates: Save PPU running order 2024-03-26 21:35:53 +02:00
Eladash
020bff1485 Savestates: add sys_rsxaudio 2023-10-02 15:38:58 +03:00
Megamouse
a90858193e Qt/logging: add format function for QString 2023-06-15 19:48:15 +02:00
Eladash
636bde6343 Logs: Fix trailing space, nbsp and unintended character 2023-06-06 09:48:27 +02:00
Eladash
b861a9c5d0 LV2: Implement set-priority thread requeue 2023-06-02 08:54:46 +03:00
Eladash
f57c8c1c35 LV2: Unconditional Timer Synchronization Fix 2023-06-02 08:54:46 +03:00
Elad Ashkenazi
23c710cf53 CPUThread.cpp: Fix an emulator crash on game exit 2023-05-22 20:04:49 +03:00
Eladash
e29b81c444 Debug Fixes 2023-05-22 20:04:49 +03:00
Margen67
5bb89328d0 Remove whitespace 2023-02-15 08:58:02 +01:00
Eladash
820e692e57 PRX: Implement multi-referenced library management 2022-12-25 16:10:32 +03:00
Eladash
3f02935844 Add some debugging information 2022-08-30 08:57:33 +02:00
Eladash
9212942724 kernel_explorer: Add info about ppu_thread::ack_suspend
The wording is bad but unless the emulation went downhill it shouldn't print on screen repeatedly.
2022-08-11 11:42:16 +03:00
Eladash
011aabe9ed LV2: Make sys_mutex and sys_lwmutex lock-free, add some busy waiting in sys_mutex_lock 2022-08-07 20:23:54 +03:00
Eladash
73aaff1b29 LV2: allocation-free synchronization syscalls
* Show waiters' ID in kernel explorer.
* Remove deque dependency from sys_sync.h
2022-08-07 20:23:54 +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
Vestral
608f823516 sys_rsxaudio: Add id to kernel explorer and some fixes 2022-05-23 13:10:46 +02:00
RipleyTom
72b2876b6a
sys_net refactor (#11740) 2022-04-09 14:51:22 +02:00
Eladash
1f3b1e1c99 Implement Emulator::GetFakeCat()
I still have nightmares about that cat.
2021-09-17 22:15:48 +02:00
Eladash
0556837e3b
kernel_explorer: Fix VM object formatting (#10666)
* kernel_explorer: Fix VM object formatting
* kernel-explorer: Fix type of tree_item_names
unordered_map is completely unordered.. while with array-alike type (such as initializer_list) you can control the order of elements.
* kernel_explorer: Add control data ptr info (lwcond/lwmutex)
* kernel_explorer: Restrict lwmutex data reading furthher
2021-08-07 21:38:03 +02:00
Eladash
6a7324ab3e kernel_explorer: Atomic PPU state updates 2021-07-10 22:20:37 +03:00
Megamouse
7f7bd961e2 Qt: kernel_explorer optimizations
- roughly 10 times faster update from scratch on average
- removed some unused function
- added fatals for unexpected node failure
2021-07-10 08:18:38 +02:00
Eladash
a2d4bd4fff kernel-explorer: Add logging ability 2021-07-02 12:29:59 +02:00
Eladash
fe8d524352 Improve kernel-explorer's user experience
* Default width of dialog has been increased to fit PPU, SPURS and filesystem objects' description length.
* Height has been increased as well to allow viwing more objects at once.
* Added title of the game to the kernel explorer's windows' title.
2021-07-02 12:29:59 +02:00
Eladash
50be3bd2e5
kernel-explorer: devirtualize lv2_fs_object and print more information (#10487)
* Make lv2_fs_object an "abstract" structure with protected constructor.
* Improve kernel-explorer information for filesystem objects.
2021-06-24 16:47:14 +03:00
Eladash
44f0ca08e2 Simplify PPU exit 2021-05-25 22:47:23 +03:00
Nekotekina
2491aad6f2 types.hpp: implement min_v<>, max_v<>, SignedInt, UnsignedInt, FPInt concepts
Restrict smax to only work with signed values for consistency.
Cleanup <climits> includes.
Cleanup <limits> includes.
2021-05-23 19:43:51 +03:00
Eladash
309759b725 kernel-explorer: Save self mem-container ID and use it 2021-05-23 05:37:37 +03:00
Eladash
dcfd29c2d9 kernel-explorer: Implement PPU scheduler state information 2021-05-21 18:12:36 +02:00
Eladash
a7d0c4fb1e kernel-explorer: Fix horrible performance 2021-05-21 16:37:29 +02:00
Eladash
7a9a46e093 kernel-explorer: Implement SPU ports/interrupt tags information 2021-05-15 09:00:12 +03:00
Eladash
8bd58b1ad4 Remove lv2_event_queue::check(weak_ptr) 2021-05-15 00:31:14 +03:00
Eladash
c681395fb2 sys_interrupt: weak_ptr -> shared_ptr 2021-05-15 00:31:14 +03:00
Eladash
acded1e08a
rsx: Move sys_rsx info to rsx::thread (#10258) 2021-05-09 19:16:14 +01:00
Eladash
7a4918e4a4 kernel explorer: Implement interrupt handler/service information 2021-05-09 10:58:14 +03:00
Eladash
363cc60c82 sys_event: Save ID of self event queue 2021-05-09 10:58:14 +03:00
Eladash
64997662d2 LV2: Fixup for IPC
* Fix typo in lv2_obj::create.
* Always save ipc_key as 0 for non-shared object creations, regardless of thbe value set by creation attribute.
* Show IPC key of shared memory (sys_mmapper) memory objects in kernel explorer.
2021-05-07 14:58:22 +03:00
Eladash
7b6482c01d
LV2: Improve IPC support (#10206)
* Remove custom event queue's IPC management of favour of universal LV2 approach.
* Move ipc_manager to FXO.
* Fix ipc_manager internal storage memory leak: deallocate entry when IPC object destroyed.
* Rewrite lv2_obj::create to be simpler (remove many duplicated code).
* Always execute lv2_obj::create under both IPC and IDM mutexes at once (not in non-atomic single-steps). Fixing potential case where concurrency can cause IDM to contain 2 or more different objects with the same IPC key with SYS_SYNC_NOT_CARE (instead of the same object).
* Do not rely on smart ptr reference count to tell if the object exists. Use similar approach as event queues as it makes error checkings accurate.
* Optimize lv2_event_port by using std::shared_ptr for queue which wasn't allowed before.
2021-05-07 09:58:30 +03:00
Megamouse
4a88ffe250 Fix typo causing unreachable code 2021-04-23 22:02:52 +02:00
Eladash
72c85744b9 kernel-explorer: Show bound queue to port information
Show its IPC key or ID, depends on the queue's type.
2021-04-23 21:34:05 +03:00
Megamouse
03b76b4606 Emu: some cleanup 2021-04-09 21:03:49 +02:00
Nekotekina
ea5e837bd6 fixed_typemap.hpp: return reference 2021-03-02 16:08:14 +03:00
Eladash
5401cb7392 kernel explorer: Display all PRX/OVL segments 2021-02-12 15:27:59 +03:00
Eladash
2005c89baa memory viewer: Implement RSX mode
* Set the ground for RSX modes of register editor and insttruction editor, do not use shared ptrs directly.
* Make register editor and instruction editor modeless to allow to copypaste values from thread context etc in the background.
2021-02-02 01:05:36 +03:00
Nekotekina
db8e6fe7a7 Enable -Wunused-variable 2021-01-12 14:34:14 +03:00
Eladash
70804e2ba6 kernel explorer: Make it single-instance tool 2021-01-10 20:30:23 +01:00
Nekotekina
1ad0f24ecd Fix or silence Qt warnings 2021-01-07 13:18:48 +03:00
Nekotekina
b7bf316c1a Don't randomly include "stdafx.h"
It's file for precompiled headers.
Include what is used, don't rely on transitive includes.
2020-12-22 14:32:30 +03:00