Commit graph

224 commits

Author SHA1 Message Date
Megamouse 53817dcc90 Fix fs::file log formatting 2024-12-23 11:29:13 +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
Darkhost1999 05d12f68ad Test
Works on my machine
2024-12-05 12:55:23 +02: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
Eladash 2243e22630 sys_fs: Fix race in file stream API 2024-05-14 19:36:48 +03:00
Eladash 989b353fbd Fixup lv2_file::file_view::read() regression 2024-02-16 10:42:57 +02:00
Eladash c1607d14dc Add debug info to sys_fs_lseek 2024-02-16 10:42:57 +02:00
Eladash 08cf275bc8 Fix lv2_file::file_view::size() 2024-02-16 10:42:57 +02:00
Eladash 7db6165b46 Fix lv2_file::file_view::read_at 2024-02-14 15:11:52 +02:00
Eladash 3e8b003515 Add logging for cellFsSdataOpenByFd 2024-02-14 15:11:52 +02:00
Eladash f87e11d16a Savestates/sys_fs: Save NPDRM decryption key 2024-02-14 15:11:52 +02:00
RipleyTom 56e27bdd49 Restrict file creation in /dev_hdd0 2024-02-09 16:13:46 +02:00
Eladash a6c2e995af Crypto/PKG installer: Fix potential RAM shortage when extracing EDAT files 2024-02-05 21:56:04 +02:00
Eladash 312b35051d sys_fs: Aggregate safe file reads (optimization) 2024-01-20 22:15:07 +02: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 60baa49007 sceNp/vm: Fix strings read, implement safe string reader 2023-12-12 21:23:33 +02:00
Eladash f60bdbaece Savestates: Compressed state files 2023-11-27 12:36:17 +02:00
Eladash 0240a7d43d sys_fs: Savestate fixup 2023-10-05 05:07:46 +03:00
Eladash 4b827a8d9c sys_fs: Optimize concurrent file reads 2023-10-02 21:18:08 +03:00
Eladash 257b0f0d69 Improve lv2_file::file_view::read 2023-10-02 15:38:58 +03:00
Eladash dd518fcafb Savestates/sys_fs: Fix file saving 2023-10-02 15:38:58 +03:00
Eladash 63f045ef2e Add some error checking to sys_fs_chmod 2023-08-07 10:56:15 +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
oltolm bc40b61ef1 rename fs::stat to fs::get_stat 2023-07-25 12:15:08 +03:00
Megamouse 568e7481d8 sys_fs: use path instead of u8path
Japanese PS3 games often use unicode paths which hard crash the std::filesystem::string() method.
wstring() would work in these cases, but I guess we can just use path() instead of u8path().
2023-07-20 07:22:07 +03:00
Elad Ashkenazi 41d38975f7 Savestates/sys_fs: Utilize fs::file::get_id to fix an old bug 2023-07-17 08:09:09 +03:00
Eladash eecadab387 Implement fs::file::get_id()
File descripor ID with 2 provided ways to compare between them:
1. is_mirror_of():
 Test if identical:
  For example: when LHS writes one byte to a file at X offset, RHS file be able to read that exact byte at X offset)

2. is_coherent_with():
 Test if both files point to the same file:
  For example: if a file descriptor pointing to the complete file exists and is being truncated to 0 bytes from non-
  -zero size state: this has to affect both RHS and LHS files.
2023-07-17 08:09:09 +03:00
oltolm 0c94606fcf
Make compile with msvc, clang and gcc on Windows 2023-07-11 21:40:30 +03:00
Eladash 16f910e350 sys_fs: Fix log levels 2023-07-10 12:39:26 +03:00
brian218 70ce7ee106 sys_fs: Fixed up one of sys_fs_unmount()'s error codes to match real system behavior 2023-06-25 09:08:20 +02: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
Megamouse cd9ff08235 Decrease some include madness 2023-04-26 21:37:44 +02:00
brian218 8a509afc20 sys_fs: Implemented CELL_FS_PATH path-as-device support 2023-04-05 18:08:55 +02:00
brian218 6a95e0877b sys_fs: Fix warning C6262 2023-04-05 18:08:55 +02:00
brian218 28c37ab465 sys_fs & VFS: Misc bug fixes 2023-04-05 18:08:55 +02:00
Eladash a41d2e43fd cellFsReaddir: Fix termination sequence 2023-03-18 12:07:17 +03:00
brian218 d2dc57585c sys_fs: Improved sys_fs_fcntl(0xc0000015&0xc000001c) 2023-01-18 08:09:35 +01:00
Nekotekina 2f9cac8d18 fs: implement file::read_at
Reads from the given offset; does not seek; thread-safe.
2022-12-29 16:19:54 +03:00
brian218 cdc1d0c02b sys_fs: sys_fs_get_mount_info(): Made g_mp_sys_dev_root always reported as mounted 2022-12-10 15:28:04 +01:00