mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-05 06:21:26 +12:00
Derive RSX Replay thread from cpu_thread
Its id is set to 0, so fix some id_type() usages.
This commit is contained in:
parent
150e18539c
commit
f972fa26a4
10 changed files with 40 additions and 22 deletions
|
@ -1419,7 +1419,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) no
|
||||||
{
|
{
|
||||||
data2 = (SYS_MEMORY_PAGE_FAULT_TYPE_PPU_THREAD << 32) | cpu->id;
|
data2 = (SYS_MEMORY_PAGE_FAULT_TYPE_PPU_THREAD << 32) | cpu->id;
|
||||||
}
|
}
|
||||||
else
|
else if (cpu->id_type() == 2)
|
||||||
{
|
{
|
||||||
const auto& spu = static_cast<spu_thread&>(*cpu);
|
const auto& spu = static_cast<spu_thread&>(*cpu);
|
||||||
|
|
||||||
|
|
|
@ -671,7 +671,7 @@ bool cpu_thread::check_state() noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
verify(HERE), cpu_can_stop || !retval;
|
verify(HERE), cpu_can_stop || !retval;
|
||||||
verify(HERE), cpu_can_stop || !(state & cpu_flag::wait);
|
verify(HERE), cpu_can_stop || Emu.IsStopped() || !(state & cpu_flag::wait);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -570,13 +570,15 @@ namespace vm
|
||||||
|
|
||||||
if (_cpu && _cpu->id_type() == 1)
|
if (_cpu && _cpu->id_type() == 1)
|
||||||
{
|
{
|
||||||
thread_ctrl::emergency_exit("vm::reservation_escape");
|
// TODO: PPU g_escape
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_cpu && _cpu->id_type() == 2)
|
if (_cpu && _cpu->id_type() == 2)
|
||||||
{
|
{
|
||||||
spu_runtime::g_escape(static_cast<spu_thread*>(_cpu));
|
spu_runtime::g_escape(static_cast<spu_thread*>(_cpu));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
thread_ctrl::emergency_exit("vm::reservation_escape");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _page_map(u32 addr, u8 flags, u32 size, utils::shm* shm, std::pair<const u32, std::pair<u32, std::shared_ptr<utils::shm>>>* (*search_shm)(vm::block_t* block, utils::shm* shm))
|
static void _page_map(u32 addr, u8 flags, u32 size, utils::shm* shm, std::pair<const u32, std::pair<u32, std::shared_ptr<utils::shm>>>* (*search_shm)(vm::block_t* block, utils::shm* shm))
|
||||||
|
|
|
@ -168,7 +168,7 @@ namespace rsx
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rsx_replay_thread::on_task()
|
void rsx_replay_thread::cpu_task()
|
||||||
{
|
{
|
||||||
be_t<u32> context_id = allocate_context();
|
be_t<u32> context_id = allocate_context();
|
||||||
|
|
||||||
|
@ -239,9 +239,4 @@ namespace rsx
|
||||||
std::this_thread::sleep_for(10ms);
|
std::this_thread::sleep_for(10ms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rsx_replay_thread::operator()()
|
|
||||||
{
|
|
||||||
on_task();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "Emu/CPU/CPUThread.h"
|
||||||
#include "Emu/Cell/PPUModule.h"
|
#include "Emu/Cell/PPUModule.h"
|
||||||
#include "Emu/Cell/lv2/sys_sync.h"
|
#include "Emu/Cell/lv2/sys_sync.h"
|
||||||
#include "Emu/RSX/rsx_methods.h"
|
#include "Emu/RSX/rsx_methods.h"
|
||||||
|
@ -181,7 +182,7 @@ namespace rsx
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class rsx_replay_thread
|
class rsx_replay_thread : public cpu_thread
|
||||||
{
|
{
|
||||||
struct rsx_context
|
struct rsx_context
|
||||||
{
|
{
|
||||||
|
@ -209,12 +210,12 @@ namespace rsx
|
||||||
|
|
||||||
public:
|
public:
|
||||||
rsx_replay_thread(std::unique_ptr<frame_capture_data>&& frame_data)
|
rsx_replay_thread(std::unique_ptr<frame_capture_data>&& frame_data)
|
||||||
:frame(std::move(frame_data))
|
: cpu_thread(0)
|
||||||
|
, frame(std::move(frame_data))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_task();
|
void cpu_task() override;
|
||||||
void operator()();
|
|
||||||
private:
|
private:
|
||||||
be_t<u32> allocate_context();
|
be_t<u32> allocate_context();
|
||||||
std::vector<u32> alloc_write_fifo(be_t<u32> context_id);
|
std::vector<u32> alloc_write_fifo(be_t<u32> context_id);
|
||||||
|
|
|
@ -63,7 +63,7 @@ void breakpoint_list::AddBreakpoint(u32 pc)
|
||||||
m_breakpoint_handler->AddBreakpoint(pc);
|
m_breakpoint_handler->AddBreakpoint(pc);
|
||||||
|
|
||||||
const auto cpu = this->cpu.lock();
|
const auto cpu = this->cpu.lock();
|
||||||
const auto cpu_offset = cpu->id_type() != 1 ? static_cast<spu_thread&>(*cpu).ls : vm::g_sudo_addr;
|
const auto cpu_offset = cpu->id_type() == 2 ? static_cast<spu_thread&>(*cpu).ls : vm::g_sudo_addr;
|
||||||
m_disasm->offset = cpu_offset;
|
m_disasm->offset = cpu_offset;
|
||||||
|
|
||||||
m_disasm->disasm(m_disasm->dump_pc = pc);
|
m_disasm->disasm(m_disasm->dump_pc = pc);
|
||||||
|
|
|
@ -266,7 +266,7 @@ void debugger_frame::keyPressEvent(QKeyEvent* event)
|
||||||
{
|
{
|
||||||
const auto cpu = this->cpu.lock();
|
const auto cpu = this->cpu.lock();
|
||||||
|
|
||||||
if (!cpu || cpu->id_type() == 1)
|
if (!cpu || cpu->id_type() != 2)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -298,7 +298,17 @@ u32 debugger_frame::GetPc() const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cpu->id_type() == 1 ? static_cast<ppu_thread*>(cpu.get())->cia : static_cast<spu_thread*>(cpu.get())->pc;
|
if (cpu->id_type() == 1)
|
||||||
|
{
|
||||||
|
return static_cast<ppu_thread*>(cpu.get())->cia;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cpu->id_type() == 2)
|
||||||
|
{
|
||||||
|
return static_cast<spu_thread*>(cpu.get())->pc;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void debugger_frame::UpdateUI()
|
void debugger_frame::UpdateUI()
|
||||||
|
@ -416,7 +426,7 @@ void debugger_frame::OnSelectUnit()
|
||||||
m_disasm = std::make_unique<PPUDisAsm>(CPUDisAsm_InterpreterMode);
|
m_disasm = std::make_unique<PPUDisAsm>(CPUDisAsm_InterpreterMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (cpu0->id_type() == 2)
|
||||||
{
|
{
|
||||||
if (cpu0.get() == idm::check<named_thread<spu_thread>>(cpu0->id))
|
if (cpu0.get() == idm::check<named_thread<spu_thread>>(cpu0->id))
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,7 +43,17 @@ u32 debugger_list::GetPc() const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cpu->id_type() == 1 ? static_cast<ppu_thread*>(cpu.get())->cia : static_cast<spu_thread*>(cpu.get())->pc;
|
if (cpu->id_type() == 1)
|
||||||
|
{
|
||||||
|
return static_cast<ppu_thread*>(cpu.get())->cia;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cpu->id_type() == 2)
|
||||||
|
{
|
||||||
|
return static_cast<spu_thread*>(cpu.get())->pc;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 debugger_list::GetCenteredAddress(u32 address) const
|
u32 debugger_list::GetCenteredAddress(u32 address) const
|
||||||
|
|
|
@ -24,7 +24,7 @@ instruction_editor_dialog::instruction_editor_dialog(QWidget *parent, u32 _pc, c
|
||||||
setMinimumSize(300, sizeHint().height());
|
setMinimumSize(300, sizeHint().height());
|
||||||
|
|
||||||
const auto cpu = _cpu.get();
|
const auto cpu = _cpu.get();
|
||||||
m_cpu_offset = cpu->id_type() != 1 ? static_cast<spu_thread&>(*cpu).ls : vm::g_sudo_addr;
|
m_cpu_offset = cpu->id_type() == 2 ? static_cast<spu_thread&>(*cpu).ls : vm::g_sudo_addr;
|
||||||
QString instruction = qstr(fmt::format("%08x", *reinterpret_cast<be_t<u32>*>(m_cpu_offset + m_pc)));
|
QString instruction = qstr(fmt::format("%08x", *reinterpret_cast<be_t<u32>*>(m_cpu_offset + m_pc)));
|
||||||
|
|
||||||
QVBoxLayout* vbox_panel(new QVBoxLayout());
|
QVBoxLayout* vbox_panel(new QVBoxLayout());
|
||||||
|
|
|
@ -111,7 +111,7 @@ register_editor_dialog::register_editor_dialog(QWidget *parent, u32 _pc, const s
|
||||||
m_register_combo->addItem("Priority", +PPU_PRIO);
|
m_register_combo->addItem("Priority", +PPU_PRIO);
|
||||||
//m_register_combo->addItem("Priority 2", +PPU_PRIO2);
|
//m_register_combo->addItem("Priority 2", +PPU_PRIO2);
|
||||||
}
|
}
|
||||||
else
|
else if (_cpu->id_type() == 2)
|
||||||
{
|
{
|
||||||
for (int i = spu_r0; i <= spu_r127; i++) m_register_combo->addItem(qstr(fmt::format("r%d", i % 128)), i);
|
for (int i = spu_r0; i <= spu_r127; i++) m_register_combo->addItem(qstr(fmt::format("r%d", i % 128)), i);
|
||||||
m_register_combo->addItem("MFC Pending Events", +MFC_PEVENTS);
|
m_register_combo->addItem("MFC Pending Events", +MFC_PEVENTS);
|
||||||
|
@ -184,7 +184,7 @@ void register_editor_dialog::updateRegister(int reg)
|
||||||
else if (reg == RESERVATION_LOST) str = sstr(ppu.raddr ? tr("Lose reservation on OK") : tr("Reservation is inactive"));
|
else if (reg == RESERVATION_LOST) str = sstr(ppu.raddr ? tr("Lose reservation on OK") : tr("Reservation is inactive"));
|
||||||
else if (reg == PC) str = fmt::format("%08x", ppu.cia);
|
else if (reg == PC) str = fmt::format("%08x", ppu.cia);
|
||||||
}
|
}
|
||||||
else
|
else if (cpu->id_type() == 2)
|
||||||
{
|
{
|
||||||
const auto& spu = *static_cast<const spu_thread*>(cpu.get());
|
const auto& spu = *static_cast<const spu_thread*>(cpu.get());
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ void register_editor_dialog::OnOkay(const std::shared_ptr<cpu_thread>& _cpu)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (cpu->id_type() == 2)
|
||||||
{
|
{
|
||||||
auto& spu = *static_cast<spu_thread*>(cpu);
|
auto& spu = *static_cast<spu_thread*>(cpu);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue