From c2c559f8d93c35c2c7360c39fb2c5d90538fa5e0 Mon Sep 17 00:00:00 2001 From: Eladash Date: Sat, 31 Oct 2020 13:29:50 +0200 Subject: [PATCH] Disasm: do not allow to access previous instructions in non-interpreter mode --- rpcs3/Emu/Cell/SPUDisAsm.cpp | 5 +++++ rpcs3/Emu/Cell/SPURecompiler.cpp | 2 +- rpcs3/Emu/System.cpp | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/rpcs3/Emu/Cell/SPUDisAsm.cpp b/rpcs3/Emu/Cell/SPUDisAsm.cpp index 07783f1deb..e8f5610070 100644 --- a/rpcs3/Emu/Cell/SPUDisAsm.cpp +++ b/rpcs3/Emu/Cell/SPUDisAsm.cpp @@ -16,6 +16,11 @@ u32 SPUDisAsm::disasm(u32 pc) std::pair SPUDisAsm::try_get_const_value(u32 reg, u32 pc) const { + if (m_mode != CPUDisAsm_InterpreterMode) + { + return {}; + } + if (pc == umax) { pc = dump_pc; diff --git a/rpcs3/Emu/Cell/SPURecompiler.cpp b/rpcs3/Emu/Cell/SPURecompiler.cpp index e2aba93e53..fa9f65e293 100644 --- a/rpcs3/Emu/Cell/SPURecompiler.cpp +++ b/rpcs3/Emu/Cell/SPURecompiler.cpp @@ -3144,7 +3144,7 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point) void spu_recompiler_base::dump(const spu_program& result, std::string& out) { - SPUDisAsm dis_asm(CPUDisAsm_InterpreterMode); + SPUDisAsm dis_asm(CPUDisAsm_DumpMode); dis_asm.offset = reinterpret_cast(result.data.data()) - result.lower_bound; std::string hash; diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 521ec42b28..9026bed07d 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -1764,8 +1764,8 @@ void Emulator::Resume() // Print and reset debug data collected if (m_state == system_state::paused && g_cfg.core.ppu_debug) { - PPUDisAsm dis_asm(CPUDisAsm_InterpreterMode); - dis_asm.offset = vm::g_base_addr; + PPUDisAsm dis_asm(CPUDisAsm_DumpMode); + dis_asm.offset = vm::g_sudo_addr; std::string dump;