From 1200bbe7ccf79de36913d26f1d66097af6c4e3a9 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Thu, 8 Aug 2024 02:37:46 +0300 Subject: [PATCH] Address review comments --- rpcs3/Emu/CPU/Backends/AArch64JIT.cpp | 17 +---------------- rpcs3/Emu/CPU/Hypervisor.h | 20 +++++++++++++------- rpcs3/Emu/Cell/PPUThread.cpp | 2 +- rpcs3/Emu/Cell/PPUThread.h | 6 ++---- rpcs3/Emu/Cell/SPUThread.h | 2 +- rpcs3/emucore.vcxproj | 1 + rpcs3/emucore.vcxproj.filters | 4 ++-- 7 files changed, 21 insertions(+), 31 deletions(-) diff --git a/rpcs3/Emu/CPU/Backends/AArch64JIT.cpp b/rpcs3/Emu/CPU/Backends/AArch64JIT.cpp index 9ccc0bd251..e185a4f36b 100644 --- a/rpcs3/Emu/CPU/Backends/AArch64JIT.cpp +++ b/rpcs3/Emu/CPU/Backends/AArch64JIT.cpp @@ -21,21 +21,6 @@ LOG_CHANNEL(jit_log, "JIT"); namespace aarch64 { - // FIXME: This really should be part of fmt - static std::string join_strings(const std::vector& v, const char* delim) - { - std::string result; - for (const auto& s : v) - { - if (!result.empty()) - { - result += delim; - } - result += s; - } - return result; - } - using instruction_info_t = GHC_frame_preservation_pass::instruction_info_t; using function_info_t = GHC_frame_preservation_pass::function_info_t; @@ -414,7 +399,7 @@ namespace aarch64 } // Emit the branch - llvm_asm(irb, exit_fn, args, join_strings(constraints, ","), f.getContext()); + llvm_asm(irb, exit_fn, args, fmt::merge(constraints, ","), f.getContext()); // Delete original call instruction bit = ci->eraseFromParent(); diff --git a/rpcs3/Emu/CPU/Hypervisor.h b/rpcs3/Emu/CPU/Hypervisor.h index 0d07897816..f40428cc48 100644 --- a/rpcs3/Emu/CPU/Hypervisor.h +++ b/rpcs3/Emu/CPU/Hypervisor.h @@ -4,6 +4,18 @@ namespace rpcs3 { +#if defined(ARCH_x64) + union hypervisor_context_t + { + u64 regs[1]; + struct + { + u64 rsp; + } x86; + }; + + static_assert(sizeof(hypervisor_context_t) == 8); +#else union alignas(16) hypervisor_context_t { u64 regs[16]; @@ -29,12 +41,6 @@ namespace rpcs3 // x0-x17 unused } aarch64; - - struct - { - u64 sp; - - // Other regs unused - } x86; }; +#endif } diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index 1343e1b905..f7546ee148 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -3548,7 +3548,7 @@ static bool ppu_store_reservation(ppu_thread& ppu, u32 addr, u64 reg_value) if (notify) { -bool notified = false; + bool notified = false; if (ppu.res_notify_time == (vm::reservation_acquire(notify) & -128)) { diff --git a/rpcs3/Emu/Cell/PPUThread.h b/rpcs3/Emu/Cell/PPUThread.h index 86b6ebfa47..1b09a91e27 100644 --- a/rpcs3/Emu/Cell/PPUThread.h +++ b/rpcs3/Emu/Cell/PPUThread.h @@ -164,9 +164,6 @@ public: using cpu_thread::operator=; - // Hypervisor context data - alignas(16) rpcs3::hypervisor_context_t hv_ctx; // HV context for gate enter exit. Keep at a low struct offset. - u64 gpr[32] = {}; // General-Purpose Registers f64 fpr[32] = {}; // Floating Point Registers v128 vr[32] = {}; // Vector Registers @@ -307,7 +304,8 @@ public: // Thread name atomic_ptr ppu_tname; - u64 saved_native_sp = 0; // Host thread's stack pointer for emulated longjmp + // Hypervisor context data + rpcs3::hypervisor_context_t hv_ctx; // HV context for gate enter exit. Keep at a low struct offset. u64 last_ftsc = 0; u64 last_ftime = 0; diff --git a/rpcs3/Emu/Cell/SPUThread.h b/rpcs3/Emu/Cell/SPUThread.h index f206eb4a16..60dae8a69c 100644 --- a/rpcs3/Emu/Cell/SPUThread.h +++ b/rpcs3/Emu/Cell/SPUThread.h @@ -779,7 +779,7 @@ public: u64 block_recover = 0; u64 block_failure = 0; - alignas(16) rpcs3::hypervisor_context_t hv_ctx; // NOTE: The offset within the class must be within the first 1MiB + rpcs3::hypervisor_context_t hv_ctx; // NOTE: The offset within the class must be within the first 1MiB u64 ftx = 0; // Failed transactions u64 stx = 0; // Succeeded transactions (pure counters) diff --git a/rpcs3/emucore.vcxproj b/rpcs3/emucore.vcxproj index 7acb0e45a0..4e47f2aa88 100644 --- a/rpcs3/emucore.vcxproj +++ b/rpcs3/emucore.vcxproj @@ -536,6 +536,7 @@ + diff --git a/rpcs3/emucore.vcxproj.filters b/rpcs3/emucore.vcxproj.filters index a7b91ba672..898d086fb6 100644 --- a/rpcs3/emucore.vcxproj.filters +++ b/rpcs3/emucore.vcxproj.filters @@ -2569,8 +2569,8 @@ Emu\GPU\RSX\NV47\FW - - Emu\Io + + Emu\CPU