Possible fix for 128 meg RAM xbox

This commit is contained in:
Ryan Dortmans
2004-10-28 07:58:13 +00:00
parent b17860c1e1
commit 96275c6834
2 changed files with 49 additions and 0 deletions
@@ -90,6 +90,25 @@ bool SetupNetwork()
#endif
}
// if Xbox has 128 meg RAM make sure its used
void EnableExtraRAM()
{
LARGE_INTEGER regVal;
// Verify that we have 128 megs available
MEMORYSTATUS memStatus;
GlobalMemoryStatus( &memStatus );
if( memStatus.dwTotalPhys < (100 * 1024 * 1024) )
return;
// Grab the existing default type (0x02FF)
READMSRREG( 0x02FF, &regVal );
// Set the default to WriteBack (0x06)
regVal.LowPart = (regVal.LowPart & ~0xFF) | 0x06;
WRITEMSRREG( 0x02FF, regVal );
}
ArchHooks_Xbox::ArchHooks_Xbox()
{
XGetCustomLaunchData();
@@ -98,6 +117,8 @@ ArchHooks_Xbox::ArchHooks_Xbox()
MountDrives();
SetupNetwork();
EnableExtraRAM();
}
ArchHooks_Xbox::~ArchHooks_Xbox()
@@ -11,6 +11,34 @@ public:
~ArchHooks_Xbox();
};
// Read a 64 bit MSR register
inline void READMSRREG( UINT32 reg, LARGE_INTEGER *val )
{
UINT32 lowPart, highPart;
__asm
{
mov ecx, reg
rdmsr
mov lowPart, eax
mov highPart, edx
};
val->LowPart = lowPart;
val->HighPart = highPart;
}
// Write a 64 bit MSR register
inline void WRITEMSRREG( UINT32 reg, LARGE_INTEGER val )
{
__asm
{
mov ecx, reg
mov eax, val.LowPart
mov edx, val.HighPart
wrmsr
};
}
#undef ARCH_HOOKS
#define ARCH_HOOKS ArchHooks_Xbox