Commit graph

91 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
oltolm 2b0f786b2d
Fix std::basic_string warnings (#16261) 2024-11-11 21:54:44 +02:00
Elad Ashkenazi 6fff22391c PPU Analyzer: Utilize exported functions 2024-06-08 14:09:37 +03:00
Elad Ashkenazi 721e55458c PPU Analyzer: Fixes 2024-06-08 14:09:37 +03:00
Elad Ashkenazi 8fa23436f9 PPU Analyzer: Unuse per-instruction compilation on fallback 2024-05-30 11:41:24 +03:00
Eladash c7d93bd470 PPU Analyzer: Look for functions using callers (fallback) 2024-04-19 20:51:37 +03:00
Megamouse 59c58aa3cf fix some warnings 2023-12-30 19:07:35 +01:00
Eladash 1e1d6f6437 PPU Analyzer: Fixup 2023-09-22 10:03:51 +03:00
Eladash d399bd5b6a PPU Analyzer: Another fixup 2023-09-10 18:58:34 +03:00
Elad Ashkenazi 52495c17d6
PPU Analyzer: Fixup 2023-09-06 06:53:10 +03:00
Eladash a02c168a0d PPU Analyzer: Fixup greedy instruction search 2023-09-05 06:20:57 +03:00
Elad Ashkenazi ea57984912
SPU LLVM: Fill space between functions using targets (Precompilation)
* Revert "PPU Analyzer: Revert TRAP detection change"
2023-09-02 15:56:34 +03:00
Eladash deacf76ca4 PPU Analyzer: Revert TRAP detection change 2023-09-02 12:31:11 +03:00
Eladash be0a789e7d PPU Analyzer: Fix OPD section validation 2023-08-27 02:11:01 +03:00
Eladash 82c5c4d285 PPU Analyzer: Analyze whole segment 0 when patches are applied
Improve greedy instruction search.
2023-08-25 12:52:02 +03:00
Eladash 756ab1191e PPU Analyzer: Fix for unaligned sections 2023-08-23 10:14:29 +03:00
Eladash cdc0441405 PPU: Fixup interpreter and analyzer 2023-08-08 10:22:05 +03:00
Eladash 91b68f3b45 PPU Analyzer: Fixup verify_func 2023-08-07 06:48:44 +03:00
Eladash c96f3a877f PPU Analyzer: Add more function constraints 2023-08-06 21:37:10 +03:00
Eladash ee869a49f4 PPU Precompilation Fixup 2023-08-06 10:38:40 +03:00
Eladash 99671b754f Add ppu_module::get_ref() to ease debugging 2023-07-23 17:58:54 +03:00
Eladash 554b27a82a PPU LLVM: Implement SELF precompilation
Do not use PS3 memory for precompilation.
2023-06-28 18:34:33 +03:00
Megamouse d662a39a12 PPUAnalyser: fix std::move nonsense 2023-06-14 11:05:00 +03:00
Eladash 0e388639cc Loader: Make executable analyzation not halt UI when launching games 2023-04-12 15:18:50 +03:00
Eladash 1dd1062be1 PPU LLVM: Fix HLE function injection 2022-08-21 15:02:01 +03:00
Nekotekina c9d8e59dbf PPU LLVM: allow to drop setting SAT flag (optimization, module-wide)
Implement ppu_attr::has_mfvscr (partially, module-wide search).
If this instruction isn't found, allow to drop setting SAT flag.
It's based on presumption that only MFVSCR can retrieve SAT flag.
2021-12-03 00:14:06 +03:00
Eladash fafefb2cf5 Fixup No.3 after #10779 2021-09-10 11:46:39 +03:00
Eladash b40ed5bdb7
Patches/PPU: Extend and improve patching capabilities (code allocations, jumps to any address) (#10779)
* Patches/PPU: Implement dynamic code allocation + Any-Address jump patches

Also fix deallocation path of fixed allocation patches.
2021-09-01 13:38:17 +03:00
Nekotekina 160b131de3 types.hpp: implement smin, smax, amin, amax
Rewritten the following global utility constants:
`umax` returns max number, restricted to unsigned.
`smax` returns max signed number, restricted to integrals.
`smin` returns min signed number, restricted to signed.
`amin` returns smin or zero, less restricted.
`amax` returns smax or umax, less restricted.

Fix operators == and <=> for synthesized rel-ops.
2021-05-22 12:10:57 +03:00
Nekotekina 87af905018 Enable -Wunused-parameter 2021-03-06 18:07:08 +03:00
Nekotekina 0057c89eaa PPU Analyser: follow fallbacks in some cases
Fallback is an "invisible" branch to the next instruction.
This may be necessary for certain cases when patches are used.
2021-02-07 11:02:45 +03:00
Nekotekina 9e9a55df46 PPU LLVM: compile instructions from patches
For now, only as a single instruction at a time.
2021-02-07 11:02:31 +03:00
Nekotekina 9463238490 PPU Analyser: minor fixups for end pointer
Add more sanity checks for sections.
Remove some redundancy.
2021-02-07 11:02:31 +03:00
Nekotekina 58eef983e2 PPU Analyser: fix constraints for all elfs.
Added for main executable and OVLs.
Forgot to use it not just for SPRX.
2021-02-01 19:14:24 +03:00
Nekotekina d5f16ce272 PPU Analyser: better constraints for SPRX 2021-02-01 11:30:50 +03:00
Nekotekina 8a029159cd PPU Analyser: compile certain functions on per-instruction basis
PPU LLVM: optimize small blocks
2021-02-01 11:30:50 +03:00
Nekotekina 891ebd0cb1 PPU Analyser: use reloc info (disabled for now)
Add blocks from relocations.
2021-02-01 11:30:50 +03:00
Nekotekina f9ee8978ff PPU LLVM: improve analyser
Compile possibly executable holes between detected functions.
Add unused "PPU LLVM Greedy Mode" option (for future updates).
Add "nounwind" attribute to compiled functions (reduces size).
2021-02-01 11:30:50 +03:00
Nekotekina db8e6fe7a7 Enable -Wunused-variable 2021-01-12 14:34:14 +03:00
Nekotekina fb29933d3d Add usz alias for std::size_t 2020-12-18 12:23:53 +03:00
Eladash 7eb16e13bb PRX loader: Fix libfs_155.sprx loading
Fix relocations' segments referencing when there are "empty" (memsize=0) LOAD segments.
2020-12-15 11:16:45 +03:00
Nekotekina 65c04e4ddd Remove constexpr from ppu/spu decoders.
We don't need them at compile time (yet).
But can reduce compile time and complexity.
2020-12-10 15:06:01 +03:00
Nekotekina 36c8654fb8 Remove HERE macro
Some cleanup.
Add location to some functions.
2020-12-10 12:30:22 +03:00
Nekotekina 1c99a2e7fb vm: add map_self() method to utils::shm
Add complementary unmap_self() method.
Move VirtualMemory to util/vm.hpp
Minor associated include cleanup.
Move asm.h to util/asm.hpp
2020-11-08 16:43:15 +03:00
Eladash 5960de2e20 PPUAnalyzer: Check if TOC from OPD is a valid address 2020-04-19 10:56:42 +01:00
Nekotekina b1b67a13c6 Revert "Replace rotate utils with std::rotl" (partial)
This reverts commit 4d8bfe328b.
2020-04-14 19:45:53 +03:00
Nekotekina 4d8bfe328b Replace rotate utils with std::rotl
More include cleanup.
2020-04-14 16:05:58 +03:00
Nekotekina d0c199d455 Replace utils::cnttz{32,64} with std::countr_{zero,one}
Make #include <bit> mandatory.
2020-04-14 16:05:58 +03:00
Nekotekina fa29c5aa94 ppu_iname: refactor to use actual strings 2020-03-26 15:28:41 +03:00
Nekotekina 1ceb779a38 Make ppu_decoder<> objects constexpr (partial) 2020-03-24 13:46:46 +03:00