Merge pull request #6969 from lioncash/namespace
Common: Namespace GekkoDisassembler.cpp/.h
This commit is contained in:
commit
41fe7970da
|
@ -38,6 +38,8 @@
|
||||||
#include "Common/GekkoDisassembler.h"
|
#include "Common/GekkoDisassembler.h"
|
||||||
#include "Common/StringUtil.h"
|
#include "Common/StringUtil.h"
|
||||||
|
|
||||||
|
namespace Common
|
||||||
|
{
|
||||||
// version/revision
|
// version/revision
|
||||||
#define PPCDISASM_VER 1
|
#define PPCDISASM_VER 1
|
||||||
#define PPCDISASM_REV 6
|
#define PPCDISASM_REV 6
|
||||||
|
@ -2315,3 +2317,4 @@ const char* GekkoDisassembler::GetFPRName(u32 index)
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
} // namespace Common
|
||||||
|
|
|
@ -40,6 +40,8 @@
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/StringUtil.h"
|
#include "Common/StringUtil.h"
|
||||||
|
|
||||||
|
namespace Common
|
||||||
|
{
|
||||||
class GekkoDisassembler final
|
class GekkoDisassembler final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -152,3 +154,4 @@ private:
|
||||||
static unsigned short m_sreg; // Register in load/store instructions
|
static unsigned short m_sreg; // Register in load/store instructions
|
||||||
static u32 m_displacement; // Branch- or load/store displacement
|
static u32 m_displacement; // Branch- or load/store displacement
|
||||||
};
|
};
|
||||||
|
} // namespace Common
|
||||||
|
|
|
@ -173,7 +173,7 @@ std::string PPCDebugInterface::Disassemble(unsigned int address)
|
||||||
}
|
}
|
||||||
|
|
||||||
const u32 op = PowerPC::HostRead_Instruction(address);
|
const u32 op = PowerPC::HostRead_Instruction(address);
|
||||||
std::string disasm = GekkoDisassembler::Disassemble(op, address);
|
std::string disasm = Common::GekkoDisassembler::Disassemble(op, address);
|
||||||
const UGeckoInstruction inst{op};
|
const UGeckoInstruction inst{op};
|
||||||
|
|
||||||
if (inst.OPCD == 1)
|
if (inst.OPCD == 1)
|
||||||
|
|
|
@ -92,7 +92,7 @@ static void Trace(UGeckoInstruction& inst)
|
||||||
PowerPC::ppcState.ps[i][1]);
|
PowerPC::ppcState.ps[i][1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ppc_inst = GekkoDisassembler::Disassemble(inst.hex, PC);
|
const std::string ppc_inst = Common::GekkoDisassembler::Disassemble(inst.hex, PC);
|
||||||
DEBUG_LOG(POWERPC,
|
DEBUG_LOG(POWERPC,
|
||||||
"INTER PC: %08x SRR0: %08x SRR1: %08x CRval: %016lx FPSCR: %08x MSR: %08x LR: "
|
"INTER PC: %08x SRR0: %08x SRR1: %08x CRval: %016lx FPSCR: %08x MSR: %08x LR: "
|
||||||
"%08x %s %08x %s",
|
"%08x %s %08x %s",
|
||||||
|
@ -295,15 +295,18 @@ void Interpreter::Run()
|
||||||
|
|
||||||
void Interpreter::unknown_instruction(UGeckoInstruction inst)
|
void Interpreter::unknown_instruction(UGeckoInstruction inst)
|
||||||
{
|
{
|
||||||
std::string disasm = GekkoDisassembler::Disassemble(PowerPC::HostRead_U32(last_pc), last_pc);
|
const u32 opcode = PowerPC::HostRead_U32(last_pc);
|
||||||
|
const std::string disasm = Common::GekkoDisassembler::Disassemble(opcode, last_pc);
|
||||||
NOTICE_LOG(POWERPC, "Last PC = %08x : %s", last_pc, disasm.c_str());
|
NOTICE_LOG(POWERPC, "Last PC = %08x : %s", last_pc, disasm.c_str());
|
||||||
Dolphin_Debugger::PrintCallstack();
|
Dolphin_Debugger::PrintCallstack();
|
||||||
NOTICE_LOG(POWERPC,
|
NOTICE_LOG(POWERPC,
|
||||||
"\nIntCPU: Unknown instruction %08x at PC = %08x last_PC = %08x LR = %08x\n",
|
"\nIntCPU: Unknown instruction %08x at PC = %08x last_PC = %08x LR = %08x\n",
|
||||||
inst.hex, PC, last_pc, LR);
|
inst.hex, PC, last_pc, LR);
|
||||||
for (int i = 0; i < 32; i += 4)
|
for (int i = 0; i < 32; i += 4)
|
||||||
|
{
|
||||||
NOTICE_LOG(POWERPC, "r%d: 0x%08x r%d: 0x%08x r%d:0x%08x r%d: 0x%08x", i, rGPR[i], i + 1,
|
NOTICE_LOG(POWERPC, "r%d: 0x%08x r%d: 0x%08x r%d:0x%08x r%d: 0x%08x", i, rGPR[i], i + 1,
|
||||||
rGPR[i + 1], i + 2, rGPR[i + 2], i + 3, rGPR[i + 3]);
|
rGPR[i + 1], i + 2, rGPR[i + 2], i + 3, rGPR[i + 3]);
|
||||||
|
}
|
||||||
ASSERT_MSG(POWERPC, 0,
|
ASSERT_MSG(POWERPC, 0,
|
||||||
"\nIntCPU: Unknown instruction %08x at PC = %08x last_PC = %08x LR = %08x\n",
|
"\nIntCPU: Unknown instruction %08x at PC = %08x last_PC = %08x LR = %08x\n",
|
||||||
inst.hex, PC, last_pc, LR);
|
inst.hex, PC, last_pc, LR);
|
||||||
|
|
|
@ -931,7 +931,7 @@ const u8* Jit64::DoJit(u32 em_address, JitBlock* b, u32 nextPC)
|
||||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||||
if (gpr.SanityCheck() || fpr.SanityCheck())
|
if (gpr.SanityCheck() || fpr.SanityCheck())
|
||||||
{
|
{
|
||||||
std::string ppc_inst = GekkoDisassembler::Disassemble(op.inst.hex, em_address);
|
std::string ppc_inst = Common::GekkoDisassembler::Disassemble(op.inst.hex, em_address);
|
||||||
// NOTICE_LOG(DYNA_REC, "Unflushed register: %s", ppc_inst.c_str());
|
// NOTICE_LOG(DYNA_REC, "Unflushed register: %s", ppc_inst.c_str());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -133,9 +133,8 @@ void LogGeneratedX86(size_t size, const PPCAnalyst::CodeBuffer& code_buffer, con
|
||||||
for (size_t i = 0; i < size; i++)
|
for (size_t i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
const PPCAnalyst::CodeOp& op = code_buffer[i];
|
const PPCAnalyst::CodeOp& op = code_buffer[i];
|
||||||
std::string temp = StringFromFormat(
|
const std::string disasm = Common::GekkoDisassembler::Disassemble(op.inst.hex, op.address);
|
||||||
"%08x %s", op.address, GekkoDisassembler::Disassemble(op.inst.hex, op.address).c_str());
|
DEBUG_LOG(DYNA_REC, "IR_X86 PPC: %08x %s\n", op.address, disasm.c_str());
|
||||||
DEBUG_LOG(DYNA_REC, "IR_X86 PPC: %s\n", temp.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
disassembler x64disasm;
|
disassembler x64disasm;
|
||||||
|
|
|
@ -163,7 +163,7 @@ void JITWidget::Update()
|
||||||
for (u32 i = 0; i < code_block.m_num_instructions; i++)
|
for (u32 i = 0; i < code_block.m_num_instructions; i++)
|
||||||
{
|
{
|
||||||
const PPCAnalyst::CodeOp& op = code_buffer[i];
|
const PPCAnalyst::CodeOp& op = code_buffer[i];
|
||||||
std::string opcode = GekkoDisassembler::Disassemble(op.inst.hex, op.address);
|
const std::string opcode = Common::GekkoDisassembler::Disassemble(op.inst.hex, op.address);
|
||||||
ppc_disasm << std::setfill('0') << std::setw(8) << std::hex << op.address;
|
ppc_disasm << std::setfill('0') << std::setw(8) << std::hex << op.address;
|
||||||
ppc_disasm << " " << opcode << std::endl;
|
ppc_disasm << " " << opcode << std::endl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,6 +85,6 @@ void AssemblerEntryDialog::OnTextChanged(wxCommandEvent& evt)
|
||||||
unsigned long code;
|
unsigned long code;
|
||||||
std::string result = "Input text is invalid";
|
std::string result = "Input text is invalid";
|
||||||
if (evt.GetString().ToULong(&code, 0) && code <= std::numeric_limits<u32>::max())
|
if (evt.GetString().ToULong(&code, 0) && code <= std::numeric_limits<u32>::max())
|
||||||
result = TabsToSpaces(1, GekkoDisassembler::Disassemble(code, m_address));
|
result = TabsToSpaces(1, Common::GekkoDisassembler::Disassemble(code, m_address));
|
||||||
m_preview->SetLabel(wxString::Format(_("Preview: %s"), result.c_str()));
|
m_preview->SetLabel(wxString::Format(_("Preview: %s"), result.c_str()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ void CJitWindow::Compare(u32 em_address)
|
||||||
for (u32 i = 0; i < code_block.m_num_instructions; i++)
|
for (u32 i = 0; i < code_block.m_num_instructions; i++)
|
||||||
{
|
{
|
||||||
const PPCAnalyst::CodeOp& op = code_buffer[i];
|
const PPCAnalyst::CodeOp& op = code_buffer[i];
|
||||||
std::string opcode = GekkoDisassembler::Disassemble(op.inst.hex, op.address);
|
const std::string opcode = Common::GekkoDisassembler::Disassemble(op.inst.hex, op.address);
|
||||||
ppc_disasm << std::setfill('0') << std::setw(8) << std::hex << op.address;
|
ppc_disasm << std::setfill('0') << std::setw(8) << std::hex << op.address;
|
||||||
ppc_disasm << " " << opcode << std::endl;
|
ppc_disasm << " " << opcode << std::endl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,11 +284,11 @@ wxString CRegTable::GetValue(int row, int col)
|
||||||
switch (col)
|
switch (col)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
return StrToWxStr(GekkoDisassembler::GetGPRName(row));
|
return StrToWxStr(Common::GekkoDisassembler::GetGPRName(row));
|
||||||
case 1:
|
case 1:
|
||||||
return FormatGPR(row);
|
return FormatGPR(row);
|
||||||
case 2:
|
case 2:
|
||||||
return StrToWxStr(GekkoDisassembler::GetFPRName(row));
|
return StrToWxStr(Common::GekkoDisassembler::GetFPRName(row));
|
||||||
case 3:
|
case 3:
|
||||||
return FormatFPR(row, 0);
|
return FormatFPR(row, 0);
|
||||||
case 4:
|
case 4:
|
||||||
|
|
Loading…
Reference in New Issue