Commit graph

90 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
Elad Ashkenazi 02aac2c52e sys_fs: Non-existant overflow bugfix
It would technically never overflow.. but this add minimal protection against adding beyond [PPU thread-count + entries count]
This does not induce an atomic loop which limits until entries.size() but is slower.
2024-07-28 12:36:42 +03:00
brian218 c73302f715 sys_ppu_thread: Fixed up sys_ppu_thread_join()'s check for detached threads
sys_game: Corrected sys_game_set_system_sw_version()'s error code
2024-06-10 07:44:49 +03:00
brian218 6548e3f7d0 sys_fs: Improved get_device_root() path identifying security 2024-01-10 12:37:11 +01:00
brian218 a269ae7e30 sys_fs: Prevented duplicate device mounting 2024-01-10 12:37:11 +01:00
brian218 862295d9f3 sys_fs: Fixed sys_fs_unlink()'s failing to delete files in dev_usbXXX
sys_fs: Fixed get_mp() up for dev_usbXXX
2024-01-10 12:37:11 +01:00
Eladash 8591529aad Fix sys_fs_fcntl default_sys_fs_container use 2023-12-20 19:58:21 +02:00
Eladash 0240a7d43d sys_fs: Savestate fixup 2023-10-05 05:07:46 +03:00
Eladash c3f1d39563 Improve vfs::host::rename 2023-10-03 15:50:46 +03:00
Eladash 4b827a8d9c sys_fs: Optimize concurrent file reads 2023-10-02 21:18:08 +03:00
brian218 9a5bdc9b4f sys_fs: Updated sys_fs_fcntl(0xc0000015&0xc000001c)'s error handling according to real hardware testing 2023-07-26 13:10:51 +03:00
brian218 0b829be798 sys_fs: Fixed up sys_fs_fcntl(0xc0000007) aka cellFsArcadeHddSerialNumber according to real hardware testing 2023-07-26 13:10:51 +03:00
brian218 cf4ae38699 sys_fs: Implemented get_normalized_path() 2023-06-25 09:08:20 +02:00
Megamouse 6d2f7f6e54 sys_fs: fix map entry removal in destructor 2023-06-05 23:14:12 +02:00
brian218 c85775922e sys_usbd: Implemented sys_usbd_unregister_extra_ldd() 2023-06-05 13:51:54 +03:00
brian218 6a570ae57e sys_fs: Implemented sys_fs_mount(prot=1) read-only mounting & fixed up some operation and permission checks 2023-06-05 13:51:54 +03:00
brian218 6a41b22a1b sys_fs: Further implemented cellFsArcadeHddSerialNumber (0xc0000007) 2023-05-06 10:26:37 +03:00
brian218 5696065727 sys_fs: Improved sys_fs_fcntl(0xc0000015 and 0xc000001c) by integrating duplicate code 2023-05-06 10:26:37 +03:00
brian218 e9281843bf sys_fs: Implemented mount_info_map to keep proper track of mounted devices 2023-05-06 10:26:37 +03:00
brian218 43184a271f sys_fs: Improved lv2_fs_object constructor 2023-05-06 10:26:37 +03:00
brian218 a7e1bc34de sys_fs: Improved the functionality of lv2_fs_object::get_mp() and the efficiency of mount&newfs syscalls 2023-05-06 10:26:37 +03:00
brian218 28c37ab465 sys_fs & VFS: Misc bug fixes 2023-04-05 18:08:55 +02:00
Margen67 5bb89328d0 Remove whitespace 2023-02-15 08:58:02 +01:00
brian218 d2dc57585c sys_fs: Improved sys_fs_fcntl(0xc0000015&0xc000001c) 2023-01-18 08:09:35 +01:00
brian218 6d4379059c sys_fs: Integrated get_mount_count() into sys_fs_get_mount_info_size() 2022-12-08 18:31:46 +01:00
brian218 a0f3704b41 sys_fs: Integrated the function of get_vfs() into get_mp() 2022-12-08 18:31:46 +01:00
brian218 8d9dd1d19c Implemented sys_fs_newfs() 2022-12-02 08:18:46 +01:00
brian218 b639f3c8ec Fixed up lv2_fs_mount_point stuff & Fixed loop.tmp potential leak 2022-11-19 10:42:49 +01:00
brian218 13ca1a7f09 Further implemented sys_fs_get_mount_info() and sys_fs_get_mount_info_size() 2022-11-19 10:42:49 +01:00
brian218 3cb9cd7724
sys_fs: Minor fixup (#12913)
Stubbed sys_fs_newfs
2022-11-01 19:49:50 +03:00
brian218 c7ced46707 Add support for mounting and unmounting CELL_FS_SIMPLEFS 2022-10-31 18:53:09 +03:00
brian218 61a371b106 Implemented sys_fs_mount() and sys_fs_unmount() 2022-10-28 08:51:41 +02:00
Eladash 5e2424da58 IdManager.cpp: Fix cellFs IDs 2022-09-07 17:05:51 +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
RipleyTom da6434a65a
Implements sys_fs_fcntl 0xC0000008 & 0xC000001A (#11957) 2022-06-11 13:12:42 +01:00
clienthax 350257e1a4 Fcntl 0xc0000007, 0xc0000015, 0xc000001c 2022-01-04 22:47:06 +03: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
clienthax 7197dd751a
Fcntl e0000025 (#10172)
Co-authored-by: Eladash <elad3356p@gmail.com>
2021-04-24 21:43:09 +03:00
Megamouse a16d8ba3ea More random changes 2021-04-11 14:01:51 +03:00
Nekotekina 963d150e93 Fix some -Weffc++ warnings (part 2) 2021-04-03 21:54:15 +03:00
Nekotekina 2212a131ef Fix some -Weffc++ warnings (part 1) 2021-03-31 11:27:09 +03:00
Nekotekina 8fcebebae3 Implement lv2_mp_flag::cache
Identify /dev_hdd1 without unsafe path comparison.
2021-03-16 19:37:03 +03:00
RipleyTom af8c661a64 Remove BOM markers 2020-12-06 15:30:12 +03:00
Nekotekina ee00fdb61b fs: improve handling root mountpoint
Path such as simply "/" falls into this category.
2020-10-02 14:37:58 +03:00
Nekotekina 9b22661c19 fs: improve mountpoint detection
Properly handle . and .. path components in mountpoint detection.
Remove app_home mountpoint and use mountpoint from argv[0] instead.
Add dev_root mountpoint for special purposes.
2020-10-02 12:32:35 +03:00
Eladash 7b3c0a69f3 kernel-explorer: Implement Filesystem Destcriptors information 2020-09-24 18:06:51 +03:00
Eladash b8fa6fb4c4 Win32 FS: Rewrite (fix) vfs::host::rename 2020-09-24 18:06:51 +03:00
Eladash 0b24b09a06 sys_fs: Lock dev_hdd1 mount point at cellSysCacheClear 2020-04-04 19:36:16 +01:00