add ppc disassembly to jit results viewer window

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1583 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2008-12-18 11:09:03 +00:00
parent 8cba6d933c
commit 772a29df28
3 changed files with 31 additions and 4 deletions

View File

@ -283,7 +283,7 @@ bool CanSwapAdjacentOps(const CodeOp &a, const CodeOp &b)
}
// Does not yet perform inlining - although there are plans for that.
void Flatten(u32 address, int *realsize, BlockStats *st, BlockRegStats *gpa, BlockRegStats *fpa, CodeBuffer *buffer)
bool Flatten(u32 address, int *realsize, BlockStats *st, BlockRegStats *gpa, BlockRegStats *fpa, CodeBuffer *buffer)
{
int numCycles = 0;
u32 blockstart = address;
@ -537,6 +537,7 @@ void Flatten(u32 address, int *realsize, BlockStats *st, BlockRegStats *gpa, Blo
*realsize = num_inst;
// ...
return true;
}

View File

@ -87,8 +87,7 @@ public:
int size_;
};
void Flatten(u32 address, int *realsize, BlockStats *st, BlockRegStats *gpa, BlockRegStats *fpa, CodeBuffer *buffer);
bool Flatten(u32 address, int *realsize, BlockStats *st, BlockRegStats *gpa, BlockRegStats *fpa, CodeBuffer *buffer);
void LogFunctionCall(u32 addr);
void FindFunctions(u32 startAddr, u32 endAddr, SymbolDB *func_db);
bool AnalyzeFunction(u32 startAddr, Symbol &func, int max_size = 0);

View File

@ -29,6 +29,8 @@
#include "PowerPC/PowerPC.h"
#include "PowerPC/Jit64/Jit.h"
#include "PowerPC/Jit64/JitCache.h"
#include "PowerPC/PPCAnalyst.h"
#include "PowerPCDisasm.h"
#include "Host.h"
#include "disasm.h"
@ -142,9 +144,34 @@ void CJitWindow::Compare(u32 em_address)
return;
}
Jit64::JitBlock *block = Jit64::GetBlock(block_num);
// == Fill in ppc box
u32 ppc_addr = block->originalAddress;
PPCAnalyst::CodeBuffer code_buffer(32000);
int size;
PPCAnalyst::BlockStats st;
PPCAnalyst::BlockRegStats gpa;
PPCAnalyst::BlockRegStats fpa;
if (PPCAnalyst::Flatten(ppc_addr, &size, &st, &gpa, &fpa, &code_buffer)) {
char *sptr = (char*)xDis;
for (int i = 0; i < size; i++)
{
const PPCAnalyst::CodeOp &op = code_buffer.codebuffer[i];
char temp[256];
DisassembleGekko(op.inst.hex, op.address, temp, 256);
sptr += sprintf(sptr, "%08x %s\n", op.address, temp);
}
ppc_box->SetValue(wxString::FromAscii((char*)xDis));
} else {
// hmmm
}
// == Fill in x86 box
memset(xDis, 0, 65536);
const u8 *code = (const u8 *)Jit64::GetCompiledCodeFromBlock(block_num);
u64 disasmPtr = (u64)code;
int size = block->codeSize;
size = block->codeSize;
const u8 *end = code + size;
char *sptr = (char*)xDis;