From e606130262ddfc053260c8732e4e2132eb4b4505 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Sun, 22 Mar 2020 12:23:58 +0300 Subject: [PATCH 1/2] Memoize and print r3-r6 under Current function in the ppu_thread::dump() --- rpcs3/Emu/Cell/PPUFunction.h | 2 +- rpcs3/Emu/Cell/PPUThread.cpp | 4 +++- rpcs3/Emu/Cell/PPUThread.h | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/rpcs3/Emu/Cell/PPUFunction.h b/rpcs3/Emu/Cell/PPUFunction.h index ec58e4b60bf0..024603859304 100644 --- a/rpcs3/Emu/Cell/PPUFunction.h +++ b/rpcs3/Emu/Cell/PPUFunction.h @@ -9,7 +9,7 @@ using ppu_function_t = bool(*)(ppu_thread&); const auto old_f = ppu.current_function;\ if (!old_f) ppu.last_function = #func;\ ppu.current_function = #func;\ - ppu.syscall_r3 = ppu.gpr[3];\ + std::memcpy(ppu.syscall_args, ppu.gpr + 3, sizeof(ppu.syscall_args)); \ ppu_func_detail::do_call(ppu, func);\ ppu.current_function = old_f;\ ppu.cia += 4;\ diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index e7e8e8341e51..8b037a8e7f65 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -432,7 +432,9 @@ std::string ppu_thread::dump() const ret += "Current function: "; ret += _func; ret += '\n'; - fmt::append(ret, "syscall r3: 0x%llx\n", syscall_r3); + + for (u32 i = 3; i <= 6; i++) + fmt::append(ret, " ** GPR[%d] = 0x%llx\n", i, syscall_args[i - 3]); } else if (is_paused()) { diff --git a/rpcs3/Emu/Cell/PPUThread.h b/rpcs3/Emu/Cell/PPUThread.h index ce134e3db724..8ea091df1df4 100644 --- a/rpcs3/Emu/Cell/PPUThread.h +++ b/rpcs3/Emu/Cell/PPUThread.h @@ -189,7 +189,7 @@ class ppu_thread : public cpu_thread cmd64 cmd_get(u32 index) { return cmd_queue[cmd_queue.peek() + index].load(); } u64 start_time{0}; // Sleep start timepoint - u64 syscall_r3{0}; // Save r3 before syscalls + alignas(64) u64 syscall_args[4]{0}; // Last syscall arguments stored const char* current_function{}; // Current function name for diagnosis, optimized for speed. const char* last_function{}; // Sticky copy of current_function, is not cleared on function return From 52618864491377fff1826a95bef59a04db749f6e Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Sun, 22 Mar 2020 14:10:57 +0300 Subject: [PATCH 2/2] CURL_STATICLIB macro cleanup Also move includes from headers. CURL is just void. --- rpcs3/rpcs3qt/game_compatibility.cpp | 8 +++++++- rpcs3/rpcs3qt/game_compatibility.h | 6 +----- rpcs3/rpcs3qt/update_manager.cpp | 5 +++++ rpcs3/rpcs3qt/update_manager.h | 5 +---- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/rpcs3/rpcs3qt/game_compatibility.cpp b/rpcs3/rpcs3qt/game_compatibility.cpp index 7412643043f1..f3b0108e729a 100644 --- a/rpcs3/rpcs3qt/game_compatibility.cpp +++ b/rpcs3/rpcs3qt/game_compatibility.cpp @@ -7,6 +7,12 @@ #include #include +#define NOMINMAX +#ifndef CURL_STATICLIB +#define CURL_STATICLIB +#endif +#include + LOG_CHANNEL(compat_log, "Compat"); constexpr auto qstr = QString::fromStdString; @@ -69,7 +75,7 @@ size_t game_compatibility::update_buffer(char* data, size_t size) } Q_EMIT signal_buffer_update(static_cast(new_size), max); - + return size; } diff --git a/rpcs3/rpcs3qt/game_compatibility.h b/rpcs3/rpcs3qt/game_compatibility.h index aa7a1f4e37ba..42421fb90965 100644 --- a/rpcs3/rpcs3qt/game_compatibility.h +++ b/rpcs3/rpcs3qt/game_compatibility.h @@ -5,10 +5,6 @@ #include #include -#define NOMINMAX -#define CURL_STATICLIB -#include - class gui_settings; class progress_dialog; @@ -44,7 +40,7 @@ class game_compatibility : public QObject std::atomic m_curl_result = false; std::atomic m_curl_abort = false; double m_actual_dwnld_size = -1.0; - CURL *m_curl = nullptr; + void* m_curl = nullptr; QByteArray m_curl_buf; progress_dialog* m_progress_dialog = nullptr; std::shared_ptr m_xgui_settings; diff --git a/rpcs3/rpcs3qt/update_manager.cpp b/rpcs3/rpcs3qt/update_manager.cpp index 1e314b417148..02e959a9c68c 100644 --- a/rpcs3/rpcs3qt/update_manager.cpp +++ b/rpcs3/rpcs3qt/update_manager.cpp @@ -31,6 +31,11 @@ #include #endif +#ifndef CURL_STATICLIB +#define CURL_STATICLIB +#endif +#include + LOG_CHANNEL(update_log, "UPDATER"); size_t curl_write_cb(char* ptr, size_t /*size*/, size_t nmemb, void* userdata) diff --git a/rpcs3/rpcs3qt/update_manager.h b/rpcs3/rpcs3qt/update_manager.h index 07f21e1ee587..0946903688db 100644 --- a/rpcs3/rpcs3qt/update_manager.h +++ b/rpcs3/rpcs3qt/update_manager.h @@ -1,9 +1,6 @@ #pragma once #include "stdafx.h" -#define NOMINMAX -#define CURL_STATICLIB -#include #include #include @@ -21,7 +18,7 @@ class update_manager final : public QObject progress_dialog* m_progress_dialog = nullptr; QWidget* m_parent = nullptr; - CURL *m_curl = nullptr; + void* m_curl = nullptr; QByteArray m_curl_buf; std::atomic m_curl_abort = false; std::atomic m_curl_result = false;