Commit graph

32 commits

Author SHA1 Message Date
Megamouse 33c3e3fb0f fix some warning 2024-12-28 18:10:06 +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
Eladash 526aaf7302 Fix idm::allocate_id at fixed position 2023-12-29 11:11:53 +02:00
Eladash 5dbeb68ed2 Savestates: Fix optional_savestate_state use 2023-11-27 12:36:17 +02:00
Margen67 5bb89328d0 Remove whitespace 2023-02-15 08:58:02 +01:00
Eladash 5e2424da58 IdManager.cpp: Fix cellFs IDs 2022-09-07 17:05:51 +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 4a9be0a8d2 core: Move IDM to FXO 2021-04-04 17:29:32 +03:00
RipleyTom af8c661a64 Remove BOM markers 2020-12-06 15:30:12 +03:00
Eladash 3265772ae4 idm: Implement creation/destruction invalidation counter
* "Ensures" newely created IDs won't have the same ID as old destroyed objects for lv2_obj. (256 tries cycle)

Similar to how the kernel implements it.
2020-05-24 19:24:07 +03:00
Eladash 1d4595a349 Idm: Minor assert fix 2020-02-15 10:41:15 +03:00
Nekotekina 465b16e786 Finally remove fxm from IdManager 2019-09-26 23:26:36 +03:00
Nekotekina 1b37e775be Migration to named_thread<>
Add atomic_t<>::try_dec instead of fetch_dec_sat
Add atomic_t<>::try_inc
GDBDebugServer is broken (needs rewrite)
Removed old_thread class (former named_thread)
Removed storing/rethrowing exceptions from thread
Emu.Stop doesn't inject an exception anymore
task_stack helper class removed
thread_base simplified (no shared_from_this)
thread_ctrl::spawn simplified (creates detached thread)
Implemented overrideable thread detaching logic
Disabled cellAdec, cellDmux, cellFsAio
SPUThread renamed to spu_thread
RawSPUThread removed, spu_thread used instead
Disabled deriving from ppu_thread
Partial support for thread renaming
lv2_timer... simplified, screw it
idm/fxm: butchered support for on_stop/on_init
vm: improved allocation structure (added size)
2018-10-19 22:22:35 +03:00
Nekotekina 7b27a8e993 Fix idm::init, fxm::init 2017-08-06 16:13:11 +03:00
Nekotekina b21fce4d6f IdManager improved
lv2_obj for kernel objects
Simple lookup (vector)
Another idm API refactoring
2017-01-29 21:37:04 +03:00
Nekotekina 4203f53b67 IdManager bugfixed 2017-01-28 17:59:43 +03:00
Nekotekina ee173dc3a2 IdManager fix 2017-01-26 04:22:15 +03:00
Nekotekina 591a6c8671 IdManager improved 2017-01-25 23:29:36 +03:00
Nekotekina e6bd91ada0 id_manager: embedded RTTI 2016-08-01 12:51:47 +03:00
Nekotekina e585939ac2 id_manager::id_key implemented 2016-08-01 01:35:53 +03:00
Nekotekina 9db7de29fb Syscall analysis implemented 2016-06-27 16:43:56 +03:00
Nekotekina eb889920e6 IdManager fix
Debug build fixed
Allowed get/remove with forward declarations
2016-06-21 12:23:28 +03:00
Nekotekina 266db1336d The rest 2016-05-23 16:22:25 +03:00
Ivan aafcf44581 Header optimizations (#1684)
Shouldn't break anything. I hope.
2016-04-27 01:27:24 +03:00
Nekotekina f8f067ca7c Partial commit: Emu (the rest) 2016-04-15 19:22:49 +03:00
Nekotekina 82cb8fe5bd SharedMutex improved 2015-12-04 23:37:39 +03:00
Nekotekina ca6783ba9a Threads improved, ID manager improved 2015-12-04 23:37:34 +03:00
Nekotekina 8ae3401ffa Some things improved
shared_mutex_t implemented
GUI Emu Callbacks rewritten
fxm::import, fxm::import_always implemented
cellMsgDialog rewritten
Emu.CallAfter improved (returns std::future)
2015-09-22 16:48:21 +03:00
Nekotekina c2897cddd6 id_traits, idm::get_last_id() added
id_traits for file/dir descriptors
idm::get_current_id() removed, thread-local last ID
2015-08-24 21:22:38 +03:00
Nekotekina f8afee3325 Fixed Object Manager (detached) 2015-08-24 21:22:22 +03:00
Nekotekina dd665e7363 ID manager simplified
ID manager refactoring, redundant "type" information removed
2015-08-24 21:22:19 +03:00