mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
PowerPC/MMU: Refactor to class, move to System.
This commit is contained in:
@ -987,10 +987,11 @@ void CodeViewWidget::OnReplaceInstruction()
|
||||
|
||||
const u32 addr = GetContextAddress();
|
||||
|
||||
if (!PowerPC::HostIsInstructionRAMAddress(guard, addr))
|
||||
if (!PowerPC::MMU::HostIsInstructionRAMAddress(guard, addr))
|
||||
return;
|
||||
|
||||
const PowerPC::TryReadInstResult read_result = PowerPC::TryReadInstruction(addr);
|
||||
const PowerPC::TryReadInstResult read_result =
|
||||
guard.GetSystem().GetMMU().TryReadInstruction(addr);
|
||||
if (!read_result.valid)
|
||||
return;
|
||||
|
||||
|
@ -463,7 +463,7 @@ void CodeWidget::StepOver()
|
||||
|
||||
const UGeckoInstruction inst = [&] {
|
||||
Core::CPUThreadGuard guard(system);
|
||||
return PowerPC::HostRead_Instruction(guard, PowerPC::ppcState.pc);
|
||||
return PowerPC::MMU::HostRead_Instruction(guard, PowerPC::ppcState.pc);
|
||||
}();
|
||||
|
||||
if (inst.LK)
|
||||
@ -516,7 +516,7 @@ void CodeWidget::StepOut()
|
||||
// Loop until either the current instruction is a return instruction with no Link flag
|
||||
// or a breakpoint is detected so it can step at the breakpoint. If the PC is currently
|
||||
// on a breakpoint, skip it.
|
||||
UGeckoInstruction inst = PowerPC::HostRead_Instruction(guard, PowerPC::ppcState.pc);
|
||||
UGeckoInstruction inst = PowerPC::MMU::HostRead_Instruction(guard, PowerPC::ppcState.pc);
|
||||
do
|
||||
{
|
||||
if (WillInstructionReturn(inst))
|
||||
@ -540,7 +540,7 @@ void CodeWidget::StepOut()
|
||||
PowerPC::SingleStep();
|
||||
}
|
||||
|
||||
inst = PowerPC::HostRead_Instruction(guard, PowerPC::ppcState.pc);
|
||||
inst = PowerPC::MMU::HostRead_Instruction(guard, PowerPC::ppcState.pc);
|
||||
} while (clock::now() < timeout &&
|
||||
!PowerPC::breakpoints.IsAddressBreakPoint(PowerPC::ppcState.pc));
|
||||
|
||||
|
@ -268,7 +268,8 @@ void ThreadWidget::Update()
|
||||
return QStringLiteral("%1").arg(value, 8, 16, QLatin1Char('0'));
|
||||
};
|
||||
const auto format_hex_from = [&format_hex](const Core::CPUThreadGuard& guard, u32 addr) {
|
||||
addr = PowerPC::HostIsRAMAddress(guard, addr) ? PowerPC::HostRead_U32(guard, addr) : 0;
|
||||
addr =
|
||||
PowerPC::MMU::HostIsRAMAddress(guard, addr) ? PowerPC::MMU::HostRead_U32(guard, addr) : 0;
|
||||
return format_hex(addr);
|
||||
};
|
||||
const auto get_state = [](u16 thread_state) {
|
||||
@ -449,13 +450,13 @@ void ThreadWidget::UpdateThreadCallstack(const Core::CPUThreadGuard& guard,
|
||||
u32 sp = context.gpr->at(1);
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
if (sp == 0 || sp == 0xffffffff || !PowerPC::HostIsRAMAddress(guard, sp))
|
||||
if (sp == 0 || sp == 0xffffffff || !PowerPC::MMU::HostIsRAMAddress(guard, sp))
|
||||
break;
|
||||
m_callstack_table->insertRow(i);
|
||||
m_callstack_table->setItem(i, 0, new QTableWidgetItem(format_hex(sp)));
|
||||
if (PowerPC::HostIsRAMAddress(guard, sp + 4))
|
||||
if (PowerPC::MMU::HostIsRAMAddress(guard, sp + 4))
|
||||
{
|
||||
const u32 lr_save = PowerPC::HostRead_U32(guard, sp + 4);
|
||||
const u32 lr_save = PowerPC::MMU::HostRead_U32(guard, sp + 4);
|
||||
m_callstack_table->setItem(i, 2, new QTableWidgetItem(format_hex(lr_save)));
|
||||
m_callstack_table->setItem(i, 3,
|
||||
new QTableWidgetItem(QString::fromStdString(
|
||||
@ -465,7 +466,7 @@ void ThreadWidget::UpdateThreadCallstack(const Core::CPUThreadGuard& guard,
|
||||
{
|
||||
m_callstack_table->setItem(i, 2, new QTableWidgetItem(QStringLiteral("--------")));
|
||||
}
|
||||
sp = PowerPC::HostRead_U32(guard, sp);
|
||||
sp = PowerPC::MMU::HostRead_U32(guard, sp);
|
||||
m_callstack_table->setItem(i, 1, new QTableWidgetItem(format_hex(sp)));
|
||||
}
|
||||
}
|
||||
|
@ -193,18 +193,19 @@ void WatchWidget::Update()
|
||||
|
||||
QBrush brush = QPalette().brush(QPalette::Text);
|
||||
|
||||
if (!Core::IsRunning() || !PowerPC::HostIsRAMAddress(guard, entry.address))
|
||||
if (!Core::IsRunning() || !PowerPC::MMU::HostIsRAMAddress(guard, entry.address))
|
||||
brush.setColor(Qt::red);
|
||||
|
||||
if (Core::IsRunning())
|
||||
{
|
||||
if (PowerPC::HostIsRAMAddress(guard, entry.address))
|
||||
if (PowerPC::MMU::HostIsRAMAddress(guard, entry.address))
|
||||
{
|
||||
hex->setText(QStringLiteral("%1").arg(PowerPC::HostRead_U32(guard, entry.address), 8, 16,
|
||||
QLatin1Char('0')));
|
||||
decimal->setText(QString::number(PowerPC::HostRead_U32(guard, entry.address)));
|
||||
string->setText(QString::fromStdString(PowerPC::HostGetString(guard, entry.address, 32)));
|
||||
floatValue->setText(QString::number(PowerPC::HostRead_F32(guard, entry.address)));
|
||||
hex->setText(QStringLiteral("%1").arg(PowerPC::MMU::HostRead_U32(guard, entry.address), 8,
|
||||
16, QLatin1Char('0')));
|
||||
decimal->setText(QString::number(PowerPC::MMU::HostRead_U32(guard, entry.address)));
|
||||
string->setText(
|
||||
QString::fromStdString(PowerPC::MMU::HostGetString(guard, entry.address, 32)));
|
||||
floatValue->setText(QString::number(PowerPC::MMU::HostRead_F32(guard, entry.address)));
|
||||
lockValue->setCheckState(entry.locked ? Qt::Checked : Qt::Unchecked);
|
||||
}
|
||||
}
|
||||
@ -418,7 +419,7 @@ void WatchWidget::OnItemChanged(QTableWidgetItem* item)
|
||||
}
|
||||
else
|
||||
{
|
||||
PowerPC::HostWrite_U32(guard, value, PowerPC::debug_interface.GetWatch(row).address);
|
||||
PowerPC::MMU::HostWrite_U32(guard, value, PowerPC::debug_interface.GetWatch(row).address);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -446,7 +447,7 @@ void WatchWidget::OnItemChanged(QTableWidgetItem* item)
|
||||
|
||||
void WatchWidget::LockWatchAddress(const Core::CPUThreadGuard& guard, u32 address)
|
||||
{
|
||||
const std::string memory_data_as_string = PowerPC::HostGetString(guard, address, 4);
|
||||
const std::string memory_data_as_string = PowerPC::MMU::HostGetString(guard, address, 4);
|
||||
|
||||
std::vector<u8> bytes;
|
||||
for (const char c : memory_data_as_string)
|
||||
|
Reference in New Issue
Block a user