git-svn-id: https://localhost/svn/Project64/trunk@36 111125ac-702d-7242-af9c-5ba8ae61c1ef

This commit is contained in:
zilmar 2010-06-16 07:31:47 +00:00
parent 1c585a93bd
commit 7bbfde5297
36 changed files with 329 additions and 234 deletions

Binary file not shown.

View File

@ -324,7 +324,7 @@ void CInterpreterCPU::ExecuteOps ( int Cycles )
*_NextTimer -= m_CountPerOp;
m_R4300i_Opcode[ Opcode.op ]();
/*static DWORD TestAddress = 0x80255E3C, TestValue = 0, CurrentValue = 0;
static DWORD TestAddress = 0x801AF8A0, TestValue = 0, CurrentValue = 0;
if (_MMU->LW_VAddr(TestAddress, TestValue))
{
if (TestValue != CurrentValue)
@ -332,7 +332,7 @@ void CInterpreterCPU::ExecuteOps ( int Cycles )
WriteTraceF(TraceError,"%X: %X changed (%s)",PROGRAM_COUNTER,TestAddress,R4300iOpcodeName(m_Opcode.Hex,PROGRAM_COUNTER) );
CurrentValue = TestValue;
}
}*/
}
switch (R4300iOp::m_NextInstruction)
{

View File

@ -1053,26 +1053,20 @@ void R4300iOp32::CACHE (void) {
}
void R4300iOp32::LL (void) {
#ifdef OLD_CODE
DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset;
if ((Address & 3) != 0) { ADDRESS_ERROR_EXCEPTION(Address,TRUE); }
if (m_Opcode.rt == 0) { return; }
if (!r4300i_LW_VAddr(Address,&_GPR[m_Opcode.rt].UW[0])) {
if (!_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) {
if (g_ShowTLBMisses) {
DisplayError("LW TLB: %X",Address);
DisplayError("LL TLB: %X",Address);
}
TLB_READ_EXCEPTION(Address);
} else {
_GPR[m_Opcode.rt].W[0] = _GPR[m_Opcode.rt].W[0];
}
(*_LLBit) = 1;
LLAddr = Address;
TranslateVaddr(&LLAddr);
#else
BreakPoint(__FILE__,__LINE__);
#endif
}
}
void R4300iOp32::LWC1 (void) {

View File

@ -1307,26 +1307,20 @@ void R4300iOp::CACHE (void) {
}
void R4300iOp::LL (void) {
#ifdef OLD_CODE
DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset;
if ((Address & 3) != 0) { ADDRESS_ERROR_EXCEPTION(Address,TRUE); }
if (m_Opcode.rt == 0) { return; }
if (!r4300i_LW_VAddr(Address,&_GPR[m_Opcode.rt].UW[0])) {
if (!_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) {
if (g_ShowTLBMisses) {
DisplayError("LW TLB: %X",Address);
DisplayError("LL TLB: %X",Address);
}
TLB_READ_EXCEPTION(Address);
} else {
_GPR[m_Opcode.rt].DW = _GPR[m_Opcode.rt].W[0];
}
(*_LLBit) = 1;
LLAddr = Address;
TranslateVaddr(&LLAddr);
#else
BreakPoint(__FILE__,__LINE__);
#endif
}
}
void R4300iOp::LWC1 (void) {

View File

@ -1930,12 +1930,11 @@ int CMipsMemoryVM::SH_NonMemory ( DWORD PAddr, WORD Value ) {
}
int CMipsMemoryVM::SW_NonMemory ( DWORD PAddr, DWORD Value ) {
if (PAddr >= 0x10000000 && PAddr < 0x16000000) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
if ((PAddr - 0x10000000) < RomFileSize) {
WrittenToRom = TRUE;
WroteToRom = Value;
if (PAddr >= 0x10000000 && PAddr < 0x16000000)
{
if ((PAddr - 0x10000000) < _Rom->GetRomSize()) {
m_RomWrittenTo = TRUE;
m_RomWroteValue = Value;
#ifdef ROM_IN_MAPSPACE
{
DWORD OldProtect;
@ -1946,7 +1945,6 @@ int CMipsMemoryVM::SW_NonMemory ( DWORD PAddr, DWORD Value ) {
} else {
return FALSE;
}
#endif
}
switch (PAddr & 0xFFF00000) {
@ -3122,6 +3120,7 @@ void CMipsMemoryVM::Compile_SB (void)
TempReg1 = Map_TempReg(x86_Any,Opcode.base,FALSE);
AddConstToX86Reg(TempReg1,(short)Opcode.immediate);
}
Compile_StoreInstructClean(TempReg1,4);
if (g_UseTlb) {
TempReg2 = Map_TempReg(x86_Any,-1,FALSE);
MoveX86RegToX86Reg(TempReg1, TempReg2);
@ -3264,6 +3263,7 @@ void CMipsMemoryVM::Compile_SW (void)
TempReg1 = Map_TempReg(x86_Any,Opcode.base,FALSE);
AddConstToX86Reg(TempReg1,(short)Opcode.immediate);
}
Compile_StoreInstructClean(TempReg1,4);
if (g_UseTlb) {
TempReg2 = Map_TempReg(x86_Any,-1,FALSE);
MoveX86RegToX86Reg(TempReg1, TempReg2);
@ -3530,6 +3530,57 @@ void CMipsMemoryVM::Compile_SWR (void)
}
}
void CMipsMemoryVM::Compile_StoreInstructClean (x86Reg AddressReg, int Length )
{
if (!_Recompiler->bSMM_StoreInstruc())
{
return;
}
stdstr_f strLen("%d",Length);
UnMap_AllFPRs();
x86Reg StoreTemp1 = Map_TempReg(x86_Any,-1,FALSE);
MoveX86RegToX86Reg(AddressReg, StoreTemp1);
AndConstToX86Reg(StoreTemp1,0xFFC);
JnzLabel8("NotDelaySlot",0);
BYTE * NotDelaySlotJump = m_RecompPos - 1;
BeforeCallDirect(m_RegWorkingSet);
PushImm32("CRecompiler::Remove_StoreInstruc",CRecompiler::Remove_StoreInstruc);
PushImm32(strLen.c_str(),Length);
Push(AddressReg);
MoveConstToX86reg((DWORD)_Recompiler,x86_ECX);
Call_Direct(AddressOf(CRecompiler::ClearRecompCode_Virt), "CRecompiler::ClearRecompCode_Virt");
AfterCallDirect(m_RegWorkingSet);
JmpLabel8("MemCheckDone",0);
BYTE * MemCheckDone = m_RecompPos - 1;
CPU_Message(" ");
CPU_Message(" NotDelaySlot:");
SetJump8(NotDelaySlotJump,m_RecompPos);
MoveX86RegToX86Reg(AddressReg, StoreTemp1);
ShiftRightUnsignImmed(StoreTemp1,12);
LeaRegReg(StoreTemp1,StoreTemp1,(ULONG)&(_Recompiler->FunctionTable()[0]),Multip_x4);
CompConstToX86regPointer(StoreTemp1,0);
JeLabel8("MemCheckDone",0);
BYTE * MemCheckDone2 = m_RecompPos - 1;
BeforeCallDirect(m_RegWorkingSet);
PushImm32("CRecompiler::Remove_StoreInstruc",CRecompiler::Remove_StoreInstruc);
PushImm32(strLen.c_str(),Length);
Push(AddressReg);
MoveConstToX86reg((DWORD)_Recompiler,x86_ECX);
Call_Direct(AddressOf(CRecompiler::ClearRecompCode_Virt), "CRecompiler::ClearRecompCode_Virt");
AfterCallDirect(m_RegWorkingSet);
CPU_Message(" ");
CPU_Message(" MemCheckDone:");
SetJump8(MemCheckDone,m_RecompPos);
SetJump8(MemCheckDone2,m_RecompPos);
X86Protected(StoreTemp1) = false;
}
void CMipsMemoryVM::Compile_SD (void)
{
OPCODE & Opcode = CRecompilerOps::m_Opcode;
@ -3541,25 +3592,17 @@ void CMipsMemoryVM::Compile_SD (void)
DWORD Address = cMipsRegLo(Opcode.base) + (short)Opcode.offset;
if (IsConst(Opcode.rt)) {
if (Is64Bit(Opcode.rt)) {
Compile_SW_Const(MipsRegHi(Opcode.rt), Address);
} else {
Compile_SW_Const((MipsRegLo_S(Opcode.rt) >> 31), Address);
}
Compile_SW_Const(Is64Bit(Opcode.rt) ? MipsRegHi(Opcode.rt) : (MipsRegLo_S(Opcode.rt) >> 31), Address);
Compile_SW_Const(cMipsRegLo(Opcode.rt), Address + 4);
} else if (IsMapped(Opcode.rt)) {
if (Is64Bit(Opcode.rt)) {
Compile_SW_Register(MipsRegMapHi(Opcode.rt), Address);
} else {
Compile_SW_Register(Map_TempReg(x86_Any,Opcode.rt,TRUE), Address);
}
Compile_SW_Register(Is64Bit(Opcode.rt) ? MipsRegMapHi(Opcode.rt) : Map_TempReg(x86_Any,Opcode.rt,TRUE), Address);
Compile_SW_Register(cMipsRegMapLo(Opcode.rt), Address + 4);
} else {
Compile_SW_Register(TempReg1 = Map_TempReg(x86_Any,Opcode.rt,TRUE), Address);
TempReg1 = Map_TempReg(x86_Any,Opcode.rt,TRUE);
Compile_SW_Register(TempReg1, Address);
Compile_SW_Register(Map_TempReg(TempReg1,Opcode.rt,FALSE), Address + 4);
}
return;
}
} else {
if (IsMapped(Opcode.rt)) { ProtectGPR(Opcode.rt); }
if (IsMapped(Opcode.base)) {
ProtectGPR(Opcode.base);
@ -3569,10 +3612,14 @@ void CMipsMemoryVM::Compile_SD (void)
} else {
TempReg1 = Map_TempReg(x86_Any,Opcode.base,FALSE);
}
UnProtectGPR(Opcode.base);
} else {
TempReg1 = Map_TempReg(x86_Any,Opcode.base,FALSE);
AddConstToX86Reg(TempReg1,(short)Opcode.immediate);
}
Compile_StoreInstructClean(TempReg1,8);
if (g_UseTlb) {
TempReg2 = Map_TempReg(x86_Any,-1,FALSE);
MoveX86RegToX86Reg(TempReg1, TempReg2);
@ -3631,6 +3678,7 @@ void CMipsMemoryVM::Compile_SD (void)
}
}
}
}
void CMipsMemoryVM::Compile_SDC1 (void)
{

View File

@ -120,6 +120,8 @@ private:
int SH_NonMemory ( DWORD PAddr, WORD Value );
int SW_NonMemory ( DWORD PAddr, DWORD Value );
void Compile_StoreInstructClean (x86Reg AddressReg, int Length );
mutable char m_strLabelName[100];
//BIG look up table to quickly translate the tlb to real mem address

View File

@ -46,7 +46,6 @@ float ** CSystemRegisters::_FPR_S;
double ** CSystemRegisters::_FPR_D;
DWORD * CSystemRegisters::_FPCR = NULL;
DWORD * CSystemRegisters::_LLBit = NULL;
DWORD * CSystemRegisters::_LLAddr = NULL;
ROUNDING_MODE * CSystemRegisters::_RoundingModel = NULL;
@ -229,7 +228,6 @@ void CRegisters::Reset()
m_RoundingModel = ROUND_NEAR;
m_LLBit = 0;
m_LLAddr = 0;
//Reset System Registers
memset(m_RDRAM_Interface,0,sizeof(m_RDRAM_Interface));
@ -257,7 +255,6 @@ void CRegisters::SetAsCurrentSystem ( void )
_FPR_D = m_FPR_D;
_FPCR = m_FPCR;
_LLBit = &m_LLBit;
_LLAddr = &m_LLAddr;
_RoundingModel = &m_RoundingModel;
}

View File

@ -456,7 +456,6 @@ protected:
static double ** _FPR_D;
static DWORD * _FPCR;
static DWORD * _LLBit;
static DWORD * _LLAddr;
static ROUNDING_MODE * _RoundingModel;
};

View File

@ -1652,10 +1652,7 @@ void CN64System::TLB_Unmaped ( DWORD VAddr, DWORD Len )
m_MMU_VM.TLB_Unmaped(VAddr,Len);
if (m_Recomp && m_Recomp->bSMM_TLB())
{
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
m_Recomp->ClearRecompCode_Virt(VAddr,Len,CRecompiler::Remove_TLB);
#endif
}
}

View File

@ -14,6 +14,7 @@ public:
inline const CCodeSection & EnterSection ( void ) const { return m_EnterSection; }
inline DWORD NextTest ( void ) const { return m_EnterSection.m_Test + 1; }
inline bool bDelaySlot ( void ) const { return m_bDelaySlot; }
inline const MD5Digest & Hash ( void ) const { return m_Hash; }
inline void SetVAddrFirst ( DWORD VAddr ) { m_VAddrFirst = VAddr; }
inline void SetVAddrLast ( DWORD VAddr ) { m_VAddrLast = VAddr; }
@ -31,4 +32,5 @@ private:
int m_NoOfSections; // The number of sections this block uses
bool m_bDelaySlot;
CCodeSection m_EnterSection;
MD5Digest m_Hash;
};

View File

@ -947,10 +947,10 @@ bool CCodeSection::GenerateX86Code ( DWORD Test )
UnknownOpcode(); break;
}
#ifdef tofix
if (!bRegCaching()) { WriteBackRegisters(); }
#endif
m_RegWorkingSet.UnMap_AllFPRs();
if ((m_CompilePC &0xFFC) == 0xFFC)
{

View File

@ -4,7 +4,9 @@ CCompiledFunc::CCompiledFunc( const CCodeBlock & CodeBlock ) :
m_EnterPC(CodeBlock.VAddrEnter()),
m_MinPC(CodeBlock.VAddrFirst()),
m_MaxPC(CodeBlock.VAddrLast()),
m_Function((Func)CodeBlock.CompiledLocation())
m_Function((Func)CodeBlock.CompiledLocation()),
m_Hash(CodeBlock.Hash()),
m_Next(NULL)
{
}

View File

@ -13,18 +13,24 @@ public:
inline const DWORD MinPC ( void ) const { return m_MinPC; }
inline const DWORD MaxPC ( void ) const { return m_MaxPC; }
inline const Func Function ( void ) const { return m_Function; }
inline const MD5Digest & Hash ( void ) const { return m_Hash; }
inline CCompiledFunc * Next ( void ) const { return m_Next; }
inline void SetNext ( CCompiledFunc * Next ) { m_Next = Next; }
private:
//Information
DWORD m_EnterPC; // The Entry PC
DWORD m_MinPC; // The Lowest PC in the function
DWORD m_MaxPC; // The Highest PC in the function
MD5Digest m_Hash;
//From querying the recompiler get information about the function
Func m_Function;
CCompiledFunc * m_Next;
//Validation
//QWORD MemContents[2], * MemLocation[2];
};
typedef std::vector<CCompiledFunc *> CCompiledFuncList;
typedef std::map<DWORD, CCompiledFunc *> CCompiledFuncList;

View File

@ -10,6 +10,7 @@ protected:
bool AllocateMemory ( void );
void Reset ( void );
public:
inline PCCompiledFunc_TABLE * FunctionTable ( void ) const { return m_FunctionTable; }
inline BYTE ** DelaySlotTable ( void ) const { return m_DelaySlotTable; }

View File

@ -1744,8 +1744,6 @@ void CRecompiler::RecompilerMain_ChangeMemory ( void )
CCompiledFunc * CRecompiler::CompilerCode ( void )
{
CheckRecompMem();
DWORD pAddr;
if (!_TransVaddr->TranslateVaddr(*_PROGRAM_COUNTER,pAddr))
{
@ -1753,6 +1751,24 @@ CCompiledFunc * CRecompiler::CompilerCode ( void )
return NULL;
}
CCompiledFuncList::iterator iter = m_Functions.find(*_PROGRAM_COUNTER);
if (iter != m_Functions.end())
{
for (CCompiledFunc * Func = iter->second; Func != NULL; Func = Func->Next())
{
MD5Digest Hash;
DWORD PAddr;
_TransVaddr->TranslateVaddr(Func->MinPC(),PAddr);
MD5(_MMU->Rdram() + PAddr,(Func->MaxPC() - Func->MinPC())+ 4).get_digest(Hash);
if (memcmp(Hash.digest,Func->Hash().digest,sizeof(Hash.digest)) == 0)
{
return Func;
}
}
}
CheckRecompMem();
DWORD StartTime = timeGetTime();
WriteTraceF(TraceRecompiler,"Compile Block-Start: Program Counter: %X pAddr: %X",*_PROGRAM_COUNTER,pAddr);
@ -1763,8 +1779,19 @@ CCompiledFunc * CRecompiler::CompilerCode ( void )
return NULL;
}
if (bShowRecompMemSize())
{
ShowMemUsed();
}
CCompiledFunc * Func = new CCompiledFunc(CodeBlock);
m_Functions.push_back(Func);
CCompiledFuncList::_Pairib ret = m_Functions.insert(CCompiledFuncList::value_type(Func->EnterPC(),Func));
if (ret.second == false)
{
Func->SetNext(ret.first->second->Next());
ret.first->second->SetNext(Func);
return Func;
}
return Func;
}
@ -1809,14 +1836,16 @@ void CRecompiler::ClearRecompCode_Virt(DWORD Address, int length,REMOVE_REASON R
case FuncFind_VirtualLookup:
{
DWORD AddressIndex = Address >> 0xC;
DWORD WriteStart = (Address & 0xFFC);
length = ((length + 3) & ~0x3);
BYTE ** DelaySlotFuncs = DelaySlotTable();
if ((Address & 0xFFC) == 0 && DelaySlotFuncs[AddressIndex] != NULL)
if (WriteStart == 0 && DelaySlotFuncs[AddressIndex] != NULL)
{
DelaySlotFuncs[AddressIndex] = NULL;
}
DWORD WriteStart = (Address & 0xFFC);
DWORD DataInBlock = 0x1000 - WriteStart;
int DataToWrite = length < DataInBlock ? length : DataInBlock;
int DataLeft = length - DataToWrite;
@ -1834,7 +1863,7 @@ void CRecompiler::ClearRecompCode_Virt(DWORD Address, int length,REMOVE_REASON R
}
break;
}
WriteTraceF(TraceError,"CRecompiler::ClearRecompCode_Virt Not Implemented (Address: %X, Length: %d Reason: %d)",Address,length,Reason);
//WriteTraceF(TraceError,"CRecompiler::ClearRecompCode_Virt Not Implemented (Address: %X, Length: %d Reason: %d)",Address,length,Reason);
/* CCompiledFunc * info;
do

View File

@ -1,7 +1,7 @@
class CRecompiler :
public CRecompilerSettings,
public CFunctionMap,
private CRecompMemory,
private CFunctionMap,
private CSystemRegisters
{
public:
@ -13,6 +13,7 @@ public:
Remove_ValidateFunc,
Remove_TLB,
Remove_DMA,
Remove_StoreInstruc,
};
typedef void (* DelayFunc)(void);

View File

@ -63,3 +63,16 @@ void CRecompMemory::Reset()
{
m_RecompPos = m_RecompCode;
}
void CRecompMemory::ShowMemUsed()
{
DWORD Size = m_RecompPos - m_RecompCode;
DWORD MB = Size / 0x100000;
Size -= MB * 0x100000;
DWORD KB = Size / 1024;
Size -= KB * 1024;
DWORD TotalAvaliable = m_RecompSize / 0x100000;
DisplayMessage(0,"Memory used: %d mb %-3d kb %-3d bytes Total Available: %d mb",MB,KB,Size, TotalAvaliable);
}

View File

@ -8,6 +8,7 @@ protected:
bool AllocateMemory ( void );
void CheckRecompMem ( void );
void Reset ( void );
void ShowMemUsed ( void );
inline BYTE * RecompPos ( void ) const { return m_RecompPos; }

View File

@ -1609,17 +1609,17 @@ void CRecompilerOps::SPECIAL_SLL (void) {
case 1:
ProtectGPR(m_Opcode.rt);
Map_GPR_32bit(m_Opcode.rd,TRUE,-1);
LeaRegReg(cMipsRegMapLo(m_Opcode.rd),cMipsRegMapLo(m_Opcode.rt), 2);
LeaRegReg(cMipsRegMapLo(m_Opcode.rd),cMipsRegMapLo(m_Opcode.rt), 0, Multip_x2);
break;
case 2:
ProtectGPR(m_Opcode.rt);
Map_GPR_32bit(m_Opcode.rd,TRUE,-1);
LeaRegReg(cMipsRegMapLo(m_Opcode.rd),cMipsRegMapLo(m_Opcode.rt), 4);
LeaRegReg(cMipsRegMapLo(m_Opcode.rd),cMipsRegMapLo(m_Opcode.rt), 0, Multip_x4);
break;
case 3:
ProtectGPR(m_Opcode.rt);
Map_GPR_32bit(m_Opcode.rd,TRUE,-1);
LeaRegReg(cMipsRegMapLo(m_Opcode.rd),cMipsRegMapLo(m_Opcode.rt), 8);
LeaRegReg(cMipsRegMapLo(m_Opcode.rd),cMipsRegMapLo(m_Opcode.rt), 0, Multip_x8);
break;
default:
Map_GPR_32bit(m_Opcode.rd,TRUE,m_Opcode.rt);
@ -1798,20 +1798,12 @@ void CRecompilerOps::SPECIAL_JALR (void) {
MipsRegLo(m_Opcode.rd) = m_CompilePC + 8;
MipsRegState(m_Opcode.rd) = CRegInfo::STATE_CONST_32;
if ((m_CompilePC & 0xFFC) == 0xFFC) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
if (IsMapped(m_Opcode.rs)) {
MoveX86regToVariable(cMipsRegLo(m_Opcode.rs),&JumpToLocation, "JumpToLocation");
Push(cMipsRegMapLo(m_Opcode.rs));
} else {
MoveX86regToVariable(Map_TempReg(x86_Any,m_Opcode.rs,FALSE),&JumpToLocation, "JumpToLocation");
Push(Map_TempReg(x86_Any,m_Opcode.rs,FALSE));
}
MoveConstToVariable(m_CompilePC + 4,_PROGRAM_COUNTER,"PROGRAM_COUNTER");
UpdateCounters(&m_RegWorkingSet.BlockCycleCount(),&m_RegWorkingSet.BlockRandomModifier(),FALSE);
m_RegWorkingSet.WriteBackRegisters();
if (CPU_Type == CPU_SyncCores) { Call_Direct(SyncToPC, "SyncToPC"); }
MoveConstToVariable(DELAY_SLOT,&m_NextInstruction,"m_NextInstruction");
Ret();
#endif
m_Section->GenerateSectionLinkage();
m_NextInstruction = END_BLOCK;
return;
}
@ -3739,14 +3731,12 @@ void CRecompilerOps::COP0_MT (void) {
/************************** COP0 CO functions ***********************/
void CRecompilerOps::COP0_CO_TLBR( void) {
_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
CPU_Message(" %X %s",m_CompilePC,R4300iOpcodeName(m_Opcode.Hex,m_CompilePC));
if (!g_UseTlb) { return; }
BeforeCallDirect();
Call_Direct(TLB_ReadEntry,"TLB_ReadEntry");
AfterCallDirect();
#endif
BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)_TLB,x86_ECX);
Call_Direct(AddressOf(CTLB::ReadEntry),"CTLB::ReadEntry");
AfterCallDirect(m_RegWorkingSet);
}
void CRecompilerOps::COP0_CO_TLBWI( void) {

View File

@ -625,10 +625,7 @@ CX86Ops::x86Reg CRegInfo::Map_TempReg (CX86Ops::x86Reg Reg, int MipsReg, BOOL Lo
{
UnMap_X86reg(Reg);
}
if (x86Mapped(Reg) != Temp_Mapped)
{
CPU_Message(" regcache: allocate %s as temp storage",x86_Name(Reg));
}
if (MipsReg >= 0) {
if (LoadHiWord) {

View File

@ -75,6 +75,11 @@ bool CCodeBlock::Compile()
#endif
}
CompileExitCode();
DWORD PAddr;
_TransVaddr->TranslateVaddr(VAddrFirst(),PAddr);
MD5(_MMU->Rdram() + PAddr,(VAddrLast() - VAddrFirst()) + 4).get_digest(m_Hash);
return true;
}

View File

@ -200,6 +200,19 @@ void CX86Ops::CompConstToX86reg(x86Reg reg, DWORD Const) {
}
}
void CX86Ops::CompConstToX86regPointer(x86Reg reg, DWORD Const) {
if ((Const & 0xFFFFFF80) != 0 && (Const & 0xFFFFFF80) != 0xFFFFFF80)
{
CPU_Message(" cmp dword ptr [%s], %Xh",x86_Name(reg),Const);
PUTDST16(m_RecompPos,0x3881 + (reg * 0x100));
PUTDST32(m_RecompPos,Const);
} else {
CPU_Message(" cmp byte ptr [%s], %Xh",x86_Name(reg),Const);
PUTDST16(m_RecompPos,0x3883 + (reg * 0x100));
PUTDST8(m_RecompPos, Const);
}
}
void CX86Ops::CompX86regToVariable(x86Reg reg, void * Variable, const char * VariableName) {
CPU_Message(" cmp %s, dword ptr [%s]",x86_Name(reg),VariableName);
PUTDST16(m_RecompPos,0x053B + (reg * 0x800));
@ -496,55 +509,65 @@ void CX86Ops::JnsLabel32(const char *Label, DWORD Value) {
PUTDST32(m_RecompPos,Value);
}
void CX86Ops::JnzLabel8(const char *Label, BYTE Value)
{
CPU_Message(" jnz $%s",Label);
PUTDST8(m_RecompPos,0x75);
PUTDST8(m_RecompPos,Value);
}
void CX86Ops::JnzLabel32(const char *Label, DWORD Value) {
CPU_Message(" jnz $%s",Label);
PUTDST16(m_RecompPos,0x850F);
PUTDST32(m_RecompPos,Value);
}
void CX86Ops::JsLabel32(const char *Label, DWORD Value) {
CPU_Message(" js $%s",Label);
PUTDST16(m_RecompPos,0x880F);
PUTDST32(m_RecompPos,Value);
}
void CX86Ops::LeaRegReg(x86Reg regDest, x86Reg regSrc, int multiplier) {
int s;
CPU_Message(" lea %s, [%s*%i]", x86_Name(regDest), x86_Name(regSrc), multiplier);
void CX86Ops::JzLabel8(const char *Label, BYTE Value)
{
CPU_Message(" jz $%s",Label);
PUTDST8(m_RecompPos,0x74);
PUTDST8(m_RecompPos,Value);
}
void CX86Ops::JzLabel32(const char *Label, DWORD Value) {
CPU_Message(" jz $%s",Label);
PUTDST16(m_RecompPos,0x840F);
PUTDST32(m_RecompPos,Value);
}
void CX86Ops::LeaRegReg(x86Reg RegDest, x86Reg RegSrc, DWORD Const, Multipler multiplier)
{
if (Const != 0)
{
CPU_Message(" lea %s, [%s*%i+%X]", x86_Name(RegDest), x86_Name(RegSrc), multiplier,Const);
} else {
CPU_Message(" lea %s, [%s*%i]", x86_Name(RegDest), x86_Name(RegSrc), multiplier);
}
PUTDST8(m_RecompPos,0x8D);
switch (regDest) {
case x86_EAX: PUTDST8(m_RecompPos,0x04); break;
case x86_EBX: PUTDST8(m_RecompPos,0x1C); break;
case x86_ECX: PUTDST8(m_RecompPos,0x0C); break;
case x86_EDX: PUTDST8(m_RecompPos,0x14); break;
case x86_ESI: PUTDST8(m_RecompPos,0x34); break;
case x86_EDI: PUTDST8(m_RecompPos,0x3C); break;
case x86_ESP: PUTDST8(m_RecompPos,0x24); break;
case x86_EBP: PUTDST8(m_RecompPos,0x2C); break;
default:
DisplayError("LEA\nUnknown x86 Register");
PUTDST8(m_RecompPos,0x04 + (RegDest * 8));
PUTDST8(m_RecompPos,0x05 + (RegSrc * 8) + CalcMultiplyCode(multiplier));
PUTDST32(m_RecompPos,Const);
}
/* put in shifter 2(01), 4(10), 8(11) */
switch(multiplier) {
case 2: s = 0x40; break;
case 4: s = 0x80; break;
case 8: s = 0xC0; break;
default:
DisplayError("LEA\nInvalid x86 multiplier");
}
void CX86Ops::LeaRegReg2(x86Reg RegDest, x86Reg RegSrc, x86Reg RegSrc2, Multipler multiplier)
{
CPU_Message(" lea %s, [%s+%s*%i]", x86_Name(RegDest), x86_Name(RegSrc), x86_Name(RegSrc2), multiplier);
/* format ss|000000 */
switch (regSrc) {
case x86_EAX: PUTDST8(m_RecompPos,0x05|s); break;
case x86_EBX: PUTDST8(m_RecompPos,0x1D|s); break;
case x86_ECX: PUTDST8(m_RecompPos,0x0D|s); break;
case x86_EDX: PUTDST8(m_RecompPos,0x15|s); break;
case x86_ESI: PUTDST8(m_RecompPos,0x35|s); break;
case x86_EDI: PUTDST8(m_RecompPos,0x3D|s); break;
case x86_EBP: PUTDST8(m_RecompPos,0x2D|s); break;
case x86_ESP:
DisplayError("LEA\nESP is invalid"); break;
default:
DisplayError("LEA\nUnknown x86 Register");
if (RegSrc2 == x86_ESP || RegSrc2 == x86_EBP)
{
DisplayError("CX86Ops::LeaRegReg2: %s is invalid for RegSrc2",x86_Name(RegSrc2));
return;
}
PUTDST32(m_RecompPos,0x00000000);
PUTDST8(m_RecompPos,0x8D);
PUTDST8(m_RecompPos,0x04 + (RegDest * 0x8));
PUTDST8(m_RecompPos,0x05 + (RegSrc * 0x8) + RegSrc2+ CalcMultiplyCode(multiplier));
}
void CX86Ops::LeaSourceAndOffset(x86Reg x86DestReg, x86Reg x86SourceReg, int offset) {
@ -758,20 +781,10 @@ void CX86Ops::MoveConstToVariable (DWORD Const,void *Variable, const char * Vari
PUTDST32(m_RecompPos,Const);
}
void CX86Ops::MoveConstToX86Pointer(DWORD Const, x86Reg X86Pointer) {
WORD x86Command;
void CX86Ops::MoveConstToX86Pointer(DWORD Const, x86Reg X86Pointer)
{
CPU_Message(" mov dword ptr [%s], %Xh",x86_Name(X86Pointer),Const);
switch (X86Pointer) {
case x86_EAX: x86Command = 0x00C7; break;
case x86_EBX: x86Command = 0x03C7; break;
case x86_ECX: x86Command = 0x01C7; break;
case x86_EDX: x86Command = 0x02C7; break;
case x86_ESI: x86Command = 0x06C7; break;
case x86_EDI: x86Command = 0x07C7; break;
}
PUTDST16(m_RecompPos,x86Command);
PUTDST16(m_RecompPos,0x00C7 + (X86Pointer * 0x100));
PUTDST32(m_RecompPos,Const);
}

View File

@ -69,6 +69,7 @@ protected:
static void Call_Indirect ( void * FunctAddress, const char * FunctName );
static void CompConstToVariable ( DWORD Const, void * Variable, const char * VariableName );
static void CompConstToX86reg ( x86Reg Reg, DWORD Const );
static void CompConstToX86regPointer ( x86Reg Reg, DWORD Const );
static void CompX86regToVariable ( x86Reg Reg, void * Variable, const char * VariableName );
static void CompVariableToX86reg ( x86Reg Reg, void * Variable, const char * VariableName );
static void CompX86RegToX86Reg ( x86Reg Destination, x86Reg Source );
@ -102,8 +103,13 @@ protected:
static void JneLabel32 ( const char * Label, DWORD Value );
static void JnsLabel8 ( const char * Label, BYTE Value );
static void JnsLabel32 ( const char * Label, DWORD Value );
static void JnzLabel8 ( const char * Label, BYTE Value );
static void JnzLabel32 ( const char * Label, DWORD Value );
static void JsLabel32 ( const char * Label, DWORD Value );
static void LeaRegReg ( x86Reg RegDest, x86Reg RegSrc, int multiplier );
static void JzLabel8 ( const char * Label, BYTE Value );
static void JzLabel32 ( const char * Label, DWORD Value );
static void LeaRegReg ( x86Reg RegDest, x86Reg RegSrc, DWORD Const, Multipler multiplier );
static void LeaRegReg2 ( x86Reg RegDest, x86Reg RegSrc, x86Reg RegSrc2, Multipler multiplier );
static void LeaSourceAndOffset ( x86Reg x86DestReg, x86Reg x86SourceReg, int offset );
static void MoveConstByteToN64Mem ( BYTE Const, x86Reg AddrReg );
static void MoveConstHalfToN64Mem ( WORD Const, x86Reg AddrReg );

View File

@ -8,7 +8,6 @@ CMipsMemory * _MMU = NULL; //Memory of the n64
CTLB * _TLB = NULL; //TLB Unit
CRegisters * _Reg = NULL; //Current Register Set attacted to the _MMU
CNotification * _Notify = NULL;
//CSettings * _Settings;
CPlugins * _Plugins = NULL;
CN64Rom * _Rom = NULL; //The current rom that this system is executing.. it can only execute one file at the time
CAudio * _Audio = NULL;
@ -17,13 +16,6 @@ CSystemTimer * _SystemTimer = NULL;
CTransVaddr * _TransVaddr = NULL;
CSystemEvents * _SystemEvents = NULL;
MIPS_DWORD * _GPR, * _FPR, * _RegHI, * _RegLO;
DWORD * _PROGRAM_COUNTER, * _CP0, * _RegMI, * _LLBit,
* _LLAddr, * _FPCR, * _RegSI, * _RegRI, * _RegPI, * _RegAI,
* _RegVI, * _RegDPC, * _RegSP, * _RegRDRAM;
double ** _FPRDoubleLocation;
float ** _FPRFloatLocation;
int * _NextTimer;

View File

@ -16,13 +16,3 @@ extern CSystemTimer * _SystemTimer;
extern CTransVaddr * _TransVaddr;
extern CSystemEvents * _SystemEvents;
extern int * _NextTimer;
/*
extern MIPS_DWORD * _GPR, * _FPR, * _RegHI, * _RegLO;
extern DWORD * _PROGRAM_COUNTER, * _CP0, * _RegMI, * _LLBit,
* _LLAddr, * _FPCR, * _RegSI, * _RegRI, * _RegPI, * _RegAI,
* _RegVI, * _RegDPC, * _RegSP, * _RegRDRAM;
extern double ** _FPRDoubleLocation;
extern float ** _FPRFloatLocation;
*/

View File

@ -62,6 +62,7 @@ enum SettingID {
Rdb_FuncLookupMode,
Rdb_RegCache,
Rdb_BlockLinking,
Rdb_SMM_StoreInstruc,
Rdb_SMM_Cache,
Rdb_SMM_PIDMA,
Rdb_SMM_TLB,
@ -92,6 +93,7 @@ enum SettingID {
Game_SMM_ValidFunc,
Game_SMM_PIDMA,
Game_SMM_TLB,
Game_SMM_StoreInstruc,
Game_CurrentSaveState,
Game_RDRamSize,
Game_CounterFactor,

View File

@ -1,6 +1,7 @@
#include "stdafx.h"
bool CRecompilerSettings::m_bShowRecompMemSize;
bool CRecompilerSettings::m_bSMM_StoreInstruc;
bool CRecompilerSettings::m_bSMM_Protect;
bool CRecompilerSettings::m_bSMM_ValidFunc;
bool CRecompilerSettings::m_bSMM_PIDMA;
@ -15,6 +16,7 @@ DWORD CRecompilerSettings::m_LookUpMode; //FUNC_LOOKUP_METHOD
CRecompilerSettings::CRecompilerSettings()
{
_Settings->RegisterChangeCB(Game_SMM_StoreInstruc,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->RegisterChangeCB(Game_SMM_Protect,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->RegisterChangeCB(Game_SMM_ValidFunc,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->RegisterChangeCB(Game_SMM_PIDMA,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
@ -33,6 +35,7 @@ CRecompilerSettings::CRecompilerSettings()
CRecompilerSettings::~CRecompilerSettings()
{
_Settings->UnregisterChangeCB(Game_SMM_StoreInstruc,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->UnregisterChangeCB(Game_SMM_Protect,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->UnregisterChangeCB(Game_SMM_ValidFunc,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
_Settings->UnregisterChangeCB(Game_SMM_PIDMA,this,(CSettings::SettingChangedFunc)StaticRefreshSettings);
@ -49,6 +52,7 @@ CRecompilerSettings::~CRecompilerSettings()
void CRecompilerSettings::RefreshSettings()
{
m_bSMM_StoreInstruc = _Settings->LoadBool(Game_SMM_StoreInstruc);
m_bSMM_Protect = _Settings->LoadBool(Game_SMM_Protect);
m_bSMM_ValidFunc = _Settings->LoadBool(Game_SMM_ValidFunc);
m_bSMM_PIDMA = _Settings->LoadBool(Game_SMM_PIDMA);

View File

@ -12,6 +12,7 @@ class CRecompilerSettings
//Settings that can be changed on the fly
static bool m_bShowRecompMemSize;
static bool m_bSMM_StoreInstruc;
static bool m_bSMM_Protect;
static bool m_bSMM_ValidFunc;
static bool m_bSMM_PIDMA;
@ -30,6 +31,8 @@ public:
virtual ~CRecompilerSettings();
inline bool bShowRecompMemSize ( void ) const { return m_bShowRecompMemSize; }
inline bool bSMM_StoreInstruc ( void ) const { return m_bSMM_StoreInstruc; }
inline bool bSMM_Protect ( void ) const { return m_bSMM_Protect; }
inline bool bSMM_ValidFunc ( void ) const { return m_bSMM_ValidFunc; }
inline bool bSMM_PIDMA ( void ) const { return m_bSMM_PIDMA; }

View File

@ -120,6 +120,7 @@ void CSettings::AddHowToHandleSetting ()
AddHandler(Rdb_RegCache, new CSettingTypeRDBYesNo("Reg Cache",true));
AddHandler(Rdb_BlockLinking, new CSettingTypeRDBOnOff("Linking",false));
AddHandler(Rdb_SMM_Cache, new CSettingTypeRomDatabase("SMM-Cache",true));
AddHandler(Rdb_SMM_StoreInstruc, new CSettingTypeRomDatabase("SMM-StoreInstr",false));
AddHandler(Rdb_SMM_PIDMA, new CSettingTypeRomDatabase("SMM-PI DMA",true));
AddHandler(Rdb_SMM_TLB, new CSettingTypeRomDatabase("SMM-TLB",true));
AddHandler(Rdb_SMM_Protect, new CSettingTypeRomDatabase("SMM-Protect",false));
@ -157,6 +158,7 @@ void CSettings::AddHowToHandleSetting ()
AddHandler(Game_FuncLookupMode, new CSettingTypeGame("FuncFind",Rdb_FuncLookupMode));
AddHandler(Game_RegCache, new CSettingTypeGame("Reg Cache",Rdb_RegCache));
AddHandler(Game_BlockLinking, new CSettingTypeGame("Linking",Rdb_BlockLinking));
AddHandler(Game_SMM_StoreInstruc, new CSettingTypeGame("SMM-StoreInst",Rdb_SMM_StoreInstruc));
AddHandler(Game_SMM_Cache, new CSettingTypeGame("SMM-Cache",Rdb_SMM_Cache));
AddHandler(Game_SMM_PIDMA, new CSettingTypeGame("SMM-PI DMA",Rdb_SMM_PIDMA));
AddHandler(Game_SMM_TLB, new CSettingTypeGame("SMM-TLB",Rdb_SMM_TLB));

View File

@ -10,7 +10,6 @@ CGameGeneralPage::CGameGeneralPage (HWND hParent, const RECT & rcDispay )
}
AddModCheckBox(GetDlgItem(IDC_SYNC_AUDIO),Game_SyncViaAudio);
AddModCheckBox(GetDlgItem(IDC_ROM_SPHACK),Game_SPHack);
AddModCheckBox(GetDlgItem(IDC_ROM_FIXEDAUDIO),Game_FixedAudio);
AddModCheckBox(GetDlgItem(IDC_USE_TLB),Game_UseTlb);
AddModCheckBox(GetDlgItem(IDC_DELAY_SI),Game_DelaySI);

View File

@ -13,7 +13,6 @@ class CGameGeneralPage :
COMMAND_HANDLER_EX(IDC_SAVE_TYPE,LBN_SELCHANGE,ComboBoxChanged)
COMMAND_HANDLER_EX(IDC_COUNTFACT,LBN_SELCHANGE,ComboBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_SYNC_AUDIO,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_ROM_SPHACK,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_ROM_FIXEDAUDIO,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_USE_TLB,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_DELAY_SI,CheckBoxChanged)

View File

@ -18,6 +18,8 @@ CGameRecompilePage::CGameRecompilePage (HWND hParent, const RECT & rcDispay )
AddModCheckBox(GetDlgItem(IDC_SMM_VALIDATE),Game_SMM_ValidFunc);
AddModCheckBox(GetDlgItem(IDC_SMM_TLB),Game_SMM_TLB);
AddModCheckBox(GetDlgItem(IDC_SMM_PROTECT),Game_SMM_Protect);
AddModCheckBox(GetDlgItem(IDC_SMM_STORE),Game_SMM_StoreInstruc);
AddModCheckBox(GetDlgItem(IDC_ROM_SPHACK),Game_SPHack);
CModifiedComboBox * ComboBox;
ComboBox = AddModComboBox(GetDlgItem(IDC_CPU_TYPE),Game_CpuType);

View File

@ -15,6 +15,8 @@ class CGameRecompilePage :
COMMAND_ID_HANDLER_EX(IDC_SMM_VALIDATE,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_SMM_TLB,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_SMM_PROTECT,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_ROM_SPHACK,CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_SMM_STORE,CheckBoxChanged)
END_MSG_MAP()
enum { IDD = IDD_Settings_GameRecompiler };

View File

@ -226,7 +226,7 @@ END
IDD_Settings_GameGeneral DIALOGEX 0, 0, 218, 158
STYLE WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Good Name:",IDC_GOOD_NAME_TEXT,6,8,91,10
EDITTEXT IDC_GOOD_NAME,102,7,109,12,ES_AUTOHSCROLL | ES_READONLY
@ -242,17 +242,15 @@ BEGIN
COMBOBOX IDC_COUNTFACT,102,61,109,49,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
CONTROL "Sync using Audio",IDC_SYNC_AUDIO,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,6,98,91,11
BS_AUTOCHECKBOX | WS_TABSTOP,6,126,91,11
CONTROL "Use TLB",IDC_USE_TLB,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,6,126,91,11
WS_TABSTOP,102,98,91,11
CONTROL "Delay SI Interrupt",IDC_DELAY_SI,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,102,112,91,11
CONTROL "SP Hack",IDC_ROM_SPHACK,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,6,112,91,11
BS_AUTOCHECKBOX | WS_TABSTOP,6,112,91,11
CONTROL "RSP Audio Signal",IDC_AUDIO_SIGNAL,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,102,126,91,11
BS_AUTOCHECKBOX | WS_TABSTOP,102,112,91,11
CONTROL "Fixed Audio Timing",IDC_ROM_FIXEDAUDIO,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,102,98,91,11
BS_AUTOCHECKBOX | WS_TABSTOP,6,98,91,11
CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,3,92,
208,1
LTEXT "Vi Refresh Rate:",IDC_VIREFESH_TEXT,6,77,91,10
@ -717,7 +715,7 @@ END
IDD_Settings_GameRecompiler DIALOGEX 0, 0, 230, 156
STYLE WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "CPU core style:",IDC_CPU_TYPE_TEXT,4,11,106,10
COMBOBOX IDC_CPU_TYPE,113,8,99,49,CBS_DROPDOWNLIST | WS_VSCROLL |
@ -726,22 +724,26 @@ BEGIN
COMBOBOX IDC_FUNCFIND,113,25,99,49,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
CONTROL "Register caching",IDC_ROM_REGCACHE,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,6,49,95,11
GROUPBOX "Self Mod Methods",IDC_SMM_FRAME,6,63,208,54
BS_AUTOCHECKBOX | WS_TABSTOP,10,49,95,11
GROUPBOX "Self Mod Methods",IDC_SMM_FRAME,4,79,208,54
CONTROL "Cache",IDC_SMM_CACHE,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,6,75,95,9
WS_TABSTOP,10,91,89,9
CONTROL "PI DMA",IDC_SMM_DMA,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,6,87,95,9
WS_TABSTOP,10,103,89,9
CONTROL "Start Changed",IDC_SMM_VALIDATE,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,6,99,95,8
BS_AUTOCHECKBOX | WS_TABSTOP,10,115,89,8
CONTROL "Protect Memory",IDC_SMM_PROTECT,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,113,87,95,8
BS_AUTOCHECKBOX | WS_TABSTOP,116,115,89,8
CONTROL "TLB Unmapping",IDC_SMM_TLB,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,113,75,95,8
WS_TABSTOP,116,103,89,8
CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,6,42,
208,1
CONTROL "Advanced Block Linking",IDC_BLOCK_LINKING,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,113,49,95,11
CONTROL "SP Hack",IDC_ROM_SPHACK,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,10,62,91,11
CONTROL "Store Instruction",IDC_SMM_STORE,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,116,91,89,8
END
IDD_Settings_GamePlugin DIALOGEX 0, 0, 231, 206

View File

@ -141,6 +141,7 @@
#define IDC_RI_REG 1044
#define IDC_SMM_TLB 1044
#define IDC_SI_REG 1045
#define IDC_SMM_STORE 1045
#define IDC_RDRAM 1046
#define IDC_SMM_FRAME 1046
#define IDC_SP_REG 1047