mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-07 15:31:26 +12:00
PPU breakpoints resurrected
Now with zero overhead
This commit is contained in:
parent
8262d56574
commit
b20d7ff48c
3 changed files with 54 additions and 3 deletions
|
@ -118,6 +118,46 @@ extern void ppu_register_function_at(u32 addr, u32 size, ppu_function_t ptr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Breakpoint entry point
|
||||||
|
static bool ppu_break(ppu_thread& ppu, ppu_opcode_t op)
|
||||||
|
{
|
||||||
|
// Pause and wait if necessary
|
||||||
|
if (!ppu.state.test_and_set(cpu_flag::dbg_pause) && ppu.check_state())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback to the interpreter function
|
||||||
|
if (reinterpret_cast<decltype(&ppu_interpreter::UNK)>(std::uintptr_t{ppu_cache(ppu.cia)})(ppu, op))
|
||||||
|
{
|
||||||
|
ppu.cia += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set or remove breakpoint
|
||||||
|
extern void ppu_breakpoint(u32 addr)
|
||||||
|
{
|
||||||
|
if (g_cfg_ppu_decoder.get() == ppu_decoder_type::llvm)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto _break = ::narrow<u32>(reinterpret_cast<std::uintptr_t>(&ppu_break));
|
||||||
|
|
||||||
|
if (s_ppu_compiled[addr / 4] == _break)
|
||||||
|
{
|
||||||
|
// Remove breakpoint
|
||||||
|
s_ppu_compiled[addr / 4] = ppu_cache(addr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Set breakpoint
|
||||||
|
s_ppu_compiled[addr / 4] = _break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string ppu_thread::get_name() const
|
std::string ppu_thread::get_name() const
|
||||||
{
|
{
|
||||||
return fmt::format("PPU[0x%x] Thread (%s)", id, m_name);
|
return fmt::format("PPU[0x%x] Thread (%s)", id, m_name);
|
||||||
|
|
|
@ -13,14 +13,18 @@
|
||||||
#include "Emu/Cell/PPUDisAsm.h"
|
#include "Emu/Cell/PPUDisAsm.h"
|
||||||
#include "Emu/Cell/SPUDisAsm.h"
|
#include "Emu/Cell/SPUDisAsm.h"
|
||||||
#include "Emu/PSP2/ARMv7DisAsm.h"
|
#include "Emu/PSP2/ARMv7DisAsm.h"
|
||||||
|
#include "Emu/Cell/PPUInterpreter.h"
|
||||||
|
|
||||||
#include "InstructionEditor.h"
|
#include "InstructionEditor.h"
|
||||||
#include "RegisterEditor.h"
|
#include "RegisterEditor.h"
|
||||||
|
|
||||||
//static const int show_lines = 30;
|
//static const int show_lines = 30;
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
std::map<u32, bool> g_breakpoints;
|
std::map<u32, bool> g_breakpoints;
|
||||||
|
|
||||||
|
extern void ppu_breakpoint(u32 addr);
|
||||||
|
|
||||||
u32 InterpreterDisAsmFrame::GetPc() const
|
u32 InterpreterDisAsmFrame::GetPc() const
|
||||||
{
|
{
|
||||||
const auto cpu = this->cpu.lock();
|
const auto cpu = this->cpu.lock();
|
||||||
|
@ -159,6 +163,11 @@ void InterpreterDisAsmFrame::UpdateUI()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Emu.IsStopped())
|
||||||
|
{
|
||||||
|
g_breakpoints.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InterpreterDisAsmFrame::UpdateUnitList()
|
void InterpreterDisAsmFrame::UpdateUnitList()
|
||||||
|
@ -516,9 +525,11 @@ bool InterpreterDisAsmFrame::IsBreakPoint(u32 pc)
|
||||||
void InterpreterDisAsmFrame::AddBreakPoint(u32 pc)
|
void InterpreterDisAsmFrame::AddBreakPoint(u32 pc)
|
||||||
{
|
{
|
||||||
g_breakpoints.emplace(pc, false);
|
g_breakpoints.emplace(pc, false);
|
||||||
|
ppu_breakpoint(pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InterpreterDisAsmFrame::RemoveBreakPoint(u32 pc)
|
void InterpreterDisAsmFrame::RemoveBreakPoint(u32 pc)
|
||||||
{
|
{
|
||||||
return g_breakpoints.erase(pc) != 0;
|
g_breakpoints.erase(pc);
|
||||||
|
ppu_breakpoint(pc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,5 +51,5 @@ public:
|
||||||
void MouseWheel(wxMouseEvent& event);
|
void MouseWheel(wxMouseEvent& event);
|
||||||
bool IsBreakPoint(u32 pc);
|
bool IsBreakPoint(u32 pc);
|
||||||
void AddBreakPoint(u32 pc);
|
void AddBreakPoint(u32 pc);
|
||||||
bool RemoveBreakPoint(u32 pc);
|
void RemoveBreakPoint(u32 pc);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue