Fix a number of bugs in the ppc disassembler, causing valid instructions to show up as (ill). Also fix some broken indentation. Plus a panicalert for illegal instructions in ppctables. Remove some deprecated compiler flags.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1528 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
cdf64b8199
commit
162351d832
|
@ -51,7 +51,6 @@
|
||||||
UsePrecompiledHeader="2"
|
UsePrecompiledHeader="2"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
WarnAsError="false"
|
WarnAsError="false"
|
||||||
Detect64BitPortabilityProblems="true"
|
|
||||||
DebugInformationFormat="4"
|
DebugInformationFormat="4"
|
||||||
ForcedIncludeFiles="stdafx.h"
|
ForcedIncludeFiles="stdafx.h"
|
||||||
/>
|
/>
|
||||||
|
@ -116,7 +115,6 @@
|
||||||
UsePrecompiledHeader="2"
|
UsePrecompiledHeader="2"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
WarnAsError="false"
|
WarnAsError="false"
|
||||||
Detect64BitPortabilityProblems="true"
|
|
||||||
DebugInformationFormat="3"
|
DebugInformationFormat="3"
|
||||||
ForcedIncludeFiles="stdafx.h"
|
ForcedIncludeFiles="stdafx.h"
|
||||||
/>
|
/>
|
||||||
|
@ -179,7 +177,6 @@
|
||||||
UsePrecompiledHeader="2"
|
UsePrecompiledHeader="2"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
WarnAsError="false"
|
WarnAsError="false"
|
||||||
Detect64BitPortabilityProblems="true"
|
|
||||||
DebugInformationFormat="3"
|
DebugInformationFormat="3"
|
||||||
ForcedIncludeFiles="stdafx.h"
|
ForcedIncludeFiles="stdafx.h"
|
||||||
/>
|
/>
|
||||||
|
@ -245,7 +242,6 @@
|
||||||
UsePrecompiledHeader="2"
|
UsePrecompiledHeader="2"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
WarnAsError="false"
|
WarnAsError="false"
|
||||||
Detect64BitPortabilityProblems="true"
|
|
||||||
DebugInformationFormat="3"
|
DebugInformationFormat="3"
|
||||||
ForcedIncludeFiles="stdafx.h"
|
ForcedIncludeFiles="stdafx.h"
|
||||||
/>
|
/>
|
||||||
|
@ -308,7 +304,6 @@
|
||||||
UsePrecompiledHeader="2"
|
UsePrecompiledHeader="2"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
WarnAsError="false"
|
WarnAsError="false"
|
||||||
Detect64BitPortabilityProblems="true"
|
|
||||||
DebugInformationFormat="3"
|
DebugInformationFormat="3"
|
||||||
ForcedIncludeFiles="stdafx.h"
|
ForcedIncludeFiles="stdafx.h"
|
||||||
/>
|
/>
|
||||||
|
@ -374,7 +369,6 @@
|
||||||
UsePrecompiledHeader="2"
|
UsePrecompiledHeader="2"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
WarnAsError="false"
|
WarnAsError="false"
|
||||||
Detect64BitPortabilityProblems="true"
|
|
||||||
DebugInformationFormat="3"
|
DebugInformationFormat="3"
|
||||||
ForcedIncludeFiles="stdafx.h"
|
ForcedIncludeFiles="stdafx.h"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -582,9 +582,6 @@ namespace PPCDisasm
|
||||||
int bsh = (int)PPCGETB(in);
|
int bsh = (int)PPCGETB(in);
|
||||||
int mb = (int)PPCGETC(in);
|
int mb = (int)PPCGETC(in);
|
||||||
int me = (int)PPCGETM(in);
|
int me = (int)PPCGETM(in);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sprintf(dp->opcode,"rlw%s%c",name,in&1?'.':'\0');
|
sprintf(dp->opcode,"rlw%s%c",name,in&1?'.':'\0');
|
||||||
sprintf(dp->operands,"%s, %s, %s%d, %d, %d (%08x)",regnames[a],regnames[s],regsel[i],bsh,mb,me,Helper_Mask(mb, me));
|
sprintf(dp->operands,"%s, %s, %s%d, %d, %d (%08x)",regnames[a],regnames[s],regsel[i],bsh,mb,me,Helper_Mask(mb, me));
|
||||||
}
|
}
|
||||||
|
@ -978,6 +975,7 @@ namespace PPCDisasm
|
||||||
#define SPR ((inst >> 11) & 0x3ff)
|
#define SPR ((inst >> 11) & 0x3ff)
|
||||||
#define TBR ((inst >> 11) & 0x3ff)
|
#define TBR ((inst >> 11) & 0x3ff)
|
||||||
#define CRM ((inst >> 12) & 0xff)
|
#define CRM ((inst >> 12) & 0xff)
|
||||||
|
|
||||||
inline int SEX12(unsigned int x)
|
inline int SEX12(unsigned int x)
|
||||||
{
|
{
|
||||||
return x & 0x800 ? (x|0xFFFFF000) : x;
|
return x & 0x800 ? (x|0xFFFFF000) : x;
|
||||||
|
@ -1162,9 +1160,8 @@ namespace PPCDisasm
|
||||||
/* instruction, or NULL if an error occured. */
|
/* instruction, or NULL if an error occured. */
|
||||||
{
|
{
|
||||||
ppc_word in = *(dp->instr);
|
ppc_word in = *(dp->instr);
|
||||||
|
if (!dp->opcode || !dp->operands)
|
||||||
if (dp->opcode==NULL || dp->operands==NULL)
|
return NULL; /* no buffers */
|
||||||
return (NULL); /* no buffers */
|
|
||||||
|
|
||||||
#if LITTLEENDIAN
|
#if LITTLEENDIAN
|
||||||
in = (in & 0xff)<<24 | (in & 0xff00)<<8 | (in & 0xff0000)>>8 |
|
in = (in & 0xff)<<24 | (in & 0xff00)<<8 | (in & 0xff0000)>>8 |
|
||||||
|
@ -1176,6 +1173,18 @@ namespace PPCDisasm
|
||||||
|
|
||||||
switch (PPCGETIDX(in))
|
switch (PPCGETIDX(in))
|
||||||
{
|
{
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
int block = in & 0x3FFFFFF;
|
||||||
|
if (block) {
|
||||||
|
sprintf(dp->opcode, "JITblock");
|
||||||
|
sprintf(dp->operands, "%i", block);
|
||||||
|
} else {
|
||||||
|
strcpy(dp->opcode, "");
|
||||||
|
strcpy(dp->operands, "---");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
sprintf(dp->opcode,"HLE");
|
sprintf(dp->opcode,"HLE");
|
||||||
//HLE call
|
//HLE call
|
||||||
|
@ -1990,15 +1999,15 @@ namespace PPCDisasm
|
||||||
case 59:
|
case 59:
|
||||||
switch (in & 0x3e) {
|
switch (in & 0x3e) {
|
||||||
case 36:
|
case 36:
|
||||||
fdabc(dp,in,"divs",6,0);
|
fdabc(dp,in,"divs",5,0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 40:
|
case 40:
|
||||||
fdabc(dp,in,"subs",6,0);
|
fdabc(dp,in,"subs",5,0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 42:
|
case 42:
|
||||||
fdabc(dp,in,"adds",6,0);
|
fdabc(dp,in,"adds",5,0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 44:
|
case 44:
|
||||||
|
@ -2010,7 +2019,7 @@ namespace PPCDisasm
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 50:
|
case 50:
|
||||||
fdabc(dp,in,"muls",5,0);
|
fdabc(dp,in,"muls",6,0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 56:
|
case 56:
|
||||||
|
@ -2077,7 +2086,7 @@ namespace PPCDisasm
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 20:
|
case 20:
|
||||||
fdabc(dp,in,"rsqrte",2,0);
|
fdabc(dp,in,"rsqrte",3,0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 24:
|
case 24:
|
||||||
|
@ -2096,12 +2105,15 @@ namespace PPCDisasm
|
||||||
fdabc(dp,in,"nmadd",7,0);
|
fdabc(dp,in,"nmadd",7,0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 52:
|
||||||
|
sprintf(dp->opcode, "XXX dp 52");
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ill(dp,in);
|
ill(dp,in);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
switch (PPCGETIDX2(in)) {
|
switch (PPCGETIDX2(in)) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -2204,7 +2216,8 @@ namespace PPCDisasm
|
||||||
}
|
}
|
||||||
return (dp->instr + 1);
|
return (dp->instr + 1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
// What were MS thinking?
|
// What were MS thinking?
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
|
@ -645,20 +645,28 @@ void PPCTables::InitTables()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #define OPLOG
|
||||||
|
|
||||||
|
#ifdef OPLOG
|
||||||
namespace {
|
namespace {
|
||||||
std::vector<u32> rsplocations;
|
std::vector<u32> rsplocations;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void PPCTables::CompileInstruction(UGeckoInstruction _inst)
|
void PPCTables::CompileInstruction(UGeckoInstruction _inst)
|
||||||
{
|
{
|
||||||
dynaOpTable[_inst.OPCD](_inst);
|
dynaOpTable[_inst.OPCD](_inst);
|
||||||
GekkoOPInfo *info = GetOpInfo(_inst);
|
GekkoOPInfo *info = GetOpInfo(_inst);
|
||||||
if (info) {
|
if (info) {
|
||||||
|
#ifdef OPLOG
|
||||||
if (!strcmp(info->opname, "mcrfs")) {
|
if (!strcmp(info->opname, "mcrfs")) {
|
||||||
rsplocations.push_back(Jit64::js.compilerPC);
|
rsplocations.push_back(Jit64::js.compilerPC);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
info->compileCount++;
|
info->compileCount++;
|
||||||
info->lastUse = Jit64::js.compilerPC;
|
info->lastUse = Jit64::js.compilerPC;
|
||||||
|
} else {
|
||||||
|
PanicAlert("Tried to compile illegal (or unknown) instruction %08x, at %08x", _inst.hex, Jit64::js.compilerPC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -688,7 +696,6 @@ struct inf
|
||||||
void PPCTables::PrintInstructionRunCounts()
|
void PPCTables::PrintInstructionRunCounts()
|
||||||
{
|
{
|
||||||
std::vector<inf> temp;
|
std::vector<inf> temp;
|
||||||
|
|
||||||
for (int i = 0; i < m_numInstructions; i++)
|
for (int i = 0; i < m_numInstructions; i++)
|
||||||
{
|
{
|
||||||
inf x;
|
inf x;
|
||||||
|
@ -697,7 +704,6 @@ void PPCTables::PrintInstructionRunCounts()
|
||||||
temp.push_back(x);
|
temp.push_back(x);
|
||||||
}
|
}
|
||||||
std::sort(temp.begin(), temp.end());
|
std::sort(temp.begin(), temp.end());
|
||||||
|
|
||||||
for (int i = 0; i < m_numInstructions; i++)
|
for (int i = 0; i < m_numInstructions; i++)
|
||||||
{
|
{
|
||||||
LOG(GEKKO, "%s : %i", temp[i].name,temp[i].count);
|
LOG(GEKKO, "%s : %i", temp[i].name,temp[i].count);
|
||||||
|
@ -724,10 +730,12 @@ void PPCTables::LogCompiledInstructions()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
#ifdef OPLOG
|
||||||
f = fopen(StringFromFormat(FULL_LOGS_DIR "mcrfs_at.txt", time).c_str(), "w");
|
f = fopen(StringFromFormat(FULL_LOGS_DIR "mcrfs_at.txt", time).c_str(), "w");
|
||||||
for (size_t i = 0; i < rsplocations.size(); i++) {
|
for (size_t i = 0; i < rsplocations.size(); i++) {
|
||||||
fprintf(f, "mcrfs: %08x\n", rsplocations[i]);
|
fprintf(f, "mcrfs: %08x\n", rsplocations[i]);
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
#endif
|
||||||
time++;
|
time++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,6 @@
|
||||||
AssemblerListingLocation="$(IntDir)\"
|
AssemblerListingLocation="$(IntDir)\"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
WarnAsError="false"
|
WarnAsError="false"
|
||||||
Detect64BitPortabilityProblems="true"
|
|
||||||
DebugInformationFormat="4"
|
DebugInformationFormat="4"
|
||||||
ForcedIncludeFiles="stdafx.h"
|
ForcedIncludeFiles="stdafx.h"
|
||||||
/>
|
/>
|
||||||
|
@ -140,7 +139,6 @@
|
||||||
AssemblerListingLocation="$(IntDir)\"
|
AssemblerListingLocation="$(IntDir)\"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
WarnAsError="false"
|
WarnAsError="false"
|
||||||
Detect64BitPortabilityProblems="true"
|
|
||||||
DebugInformationFormat="3"
|
DebugInformationFormat="3"
|
||||||
ForcedIncludeFiles="stdafx.h"
|
ForcedIncludeFiles="stdafx.h"
|
||||||
/>
|
/>
|
||||||
|
@ -228,7 +226,6 @@
|
||||||
AssemblerListingLocation="$(IntDir)\"
|
AssemblerListingLocation="$(IntDir)\"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
WarnAsError="false"
|
WarnAsError="false"
|
||||||
Detect64BitPortabilityProblems="true"
|
|
||||||
DebugInformationFormat="3"
|
DebugInformationFormat="3"
|
||||||
ForcedIncludeFiles="stdafx.h"
|
ForcedIncludeFiles="stdafx.h"
|
||||||
/>
|
/>
|
||||||
|
@ -405,7 +402,6 @@
|
||||||
AssemblerListingLocation="$(IntDir)\"
|
AssemblerListingLocation="$(IntDir)\"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
WarnAsError="false"
|
WarnAsError="false"
|
||||||
Detect64BitPortabilityProblems="true"
|
|
||||||
DebugInformationFormat="3"
|
DebugInformationFormat="3"
|
||||||
ForcedIncludeFiles="stdafx.h"
|
ForcedIncludeFiles="stdafx.h"
|
||||||
/>
|
/>
|
||||||
|
@ -494,7 +490,6 @@
|
||||||
AssemblerListingLocation="$(IntDir)\"
|
AssemblerListingLocation="$(IntDir)\"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
WarnAsError="false"
|
WarnAsError="false"
|
||||||
Detect64BitPortabilityProblems="true"
|
|
||||||
DebugInformationFormat="3"
|
DebugInformationFormat="3"
|
||||||
ForcedIncludeFiles="stdafx.h"
|
ForcedIncludeFiles="stdafx.h"
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue