mirror of https://github.com/PCSX2/pcsx2.git
Simplified/improved the memory protection model, and optimized the EErec's block fetch slightly. Note: VM builds are still unstable, and most notably crash on almost all FMVs. Still hoping I can find a fix tho. :)
git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@596 a6443dda-0b58-4228-96e9-037be469359c
This commit is contained in:
parent
3bf7df410f
commit
42951f240c
|
@ -1036,10 +1036,8 @@ static void intExecuteBlock()
|
|||
{
|
||||
g_EEFreezeRegs = false;
|
||||
|
||||
PCSX2_MEM_PROTECT_BEGIN()
|
||||
branch2 = 0;
|
||||
while (!branch2) execI();
|
||||
PCSX2_MEM_PROTECT_END()
|
||||
}
|
||||
|
||||
void intStep()
|
||||
|
|
|
@ -78,12 +78,6 @@ void cpuReset()
|
|||
cpuIsInitialized = true;
|
||||
}
|
||||
|
||||
#ifdef PCSX2_VIRTUAL_MEM
|
||||
// VM Builds require the exception handler during memInit/Reset operations and
|
||||
// during the savestate load/save code.
|
||||
PCSX2_MEM_PROTECT_BEGIN();
|
||||
#endif
|
||||
|
||||
memReset();
|
||||
psxMemReset();
|
||||
vuMicroMemReset();
|
||||
|
@ -115,9 +109,6 @@ void cpuReset()
|
|||
rcntInit();
|
||||
psxReset();
|
||||
|
||||
#ifdef PCSX2_VIRTUAL_MEM
|
||||
PCSX2_MEM_PROTECT_END();
|
||||
#endif
|
||||
}
|
||||
|
||||
void cpuShutdown()
|
||||
|
|
|
@ -389,9 +389,12 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
|||
}
|
||||
|
||||
|
||||
void RunGui() {
|
||||
void RunGui()
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
PCSX2_MEM_PROTECT_BEGIN();
|
||||
|
||||
while( true )
|
||||
{
|
||||
if( PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE) != 0 )
|
||||
|
@ -404,6 +407,8 @@ void RunGui() {
|
|||
|
||||
Sleep(10);
|
||||
}
|
||||
|
||||
PCSX2_MEM_PROTECT_END();
|
||||
}
|
||||
|
||||
BOOL Open_File_Proc( std::string& outstr )
|
||||
|
|
|
@ -233,7 +233,6 @@ void ExecuteCpu()
|
|||
|
||||
timeBeginPeriod( 1 );
|
||||
|
||||
PCSX2_MEM_PROTECT_BEGIN();
|
||||
if( CHECK_EEREC )
|
||||
{
|
||||
while( !g_ReturnToGui )
|
||||
|
@ -250,7 +249,6 @@ void ExecuteCpu()
|
|||
SysUpdate();
|
||||
}
|
||||
}
|
||||
PCSX2_MEM_PROTECT_END();
|
||||
|
||||
timeEndPeriod( 1 );
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ static u32 s_nInstCacheSize = 0;
|
|||
|
||||
static BASEBLOCK* s_pCurBlock = NULL;
|
||||
static BASEBLOCKEX* s_pCurBlockEx = NULL;
|
||||
static BASEBLOCK* s_pDispatchBlock = NULL;
|
||||
static const BASEBLOCK* s_pDispatchBlock = NULL;
|
||||
static u32 s_nEndBlock = 0; // what pc the current block ends
|
||||
static u32 s_nHasDelay = 0;
|
||||
|
||||
|
@ -725,32 +725,12 @@ static __declspec(naked,noreturn) void DispatcherReg()
|
|||
{
|
||||
s_pDispatchBlock = PC_GETBLOCK(cpuRegs.pc);
|
||||
|
||||
if( s_pDispatchBlock->startpc != cpuRegs.pc )
|
||||
recRecompile(cpuRegs.pc);
|
||||
|
||||
__asm
|
||||
{
|
||||
/*shr edx, 14
|
||||
and edx, 0xfffffffc
|
||||
add edx, recLUT
|
||||
mov edx, dword ptr [edx]
|
||||
|
||||
mov eax, ecx
|
||||
and eax, 0xfffc
|
||||
// edx += 2*eax
|
||||
shl eax, 1
|
||||
add edx, eax*/
|
||||
|
||||
// check if startpc == cpuRegs.pc
|
||||
mov eax, s_pDispatchBlock
|
||||
mov ecx, cpuRegs.pc
|
||||
cmp ecx, dword ptr [eax+BLOCKTYPE_STARTPC]
|
||||
je CheckPtrReg
|
||||
|
||||
// recompile
|
||||
|
||||
push cpuRegs.pc // pc
|
||||
call recRecompile
|
||||
add esp, 4 // pop old param
|
||||
mov eax, s_pDispatchBlock
|
||||
CheckPtrReg:
|
||||
mov eax, dword ptr [eax]
|
||||
}
|
||||
|
||||
|
@ -767,11 +747,22 @@ CheckPtrReg:
|
|||
|
||||
__forceinline void recExecute()
|
||||
{
|
||||
// Optimization note : Compared pushad against manually pushing the regs one-by-one.
|
||||
// Manually pushing is faster, especially on Core2's and such. :)
|
||||
do {
|
||||
__asm {
|
||||
pushad
|
||||
|
||||
push ebx
|
||||
push esi
|
||||
push edi
|
||||
push ebp
|
||||
|
||||
call DispatcherReg
|
||||
popad
|
||||
|
||||
pop ebp
|
||||
pop edi
|
||||
pop esi
|
||||
pop ebx
|
||||
}
|
||||
}
|
||||
while( !recEventTest() );
|
||||
|
@ -779,15 +770,21 @@ __forceinline void recExecute()
|
|||
|
||||
static void recExecuteBlock()
|
||||
{
|
||||
PCSX2_MEM_PROTECT_BEGIN()
|
||||
__asm
|
||||
{
|
||||
pushad
|
||||
push ebx
|
||||
push esi
|
||||
push edi
|
||||
push ebp
|
||||
|
||||
call DispatcherReg
|
||||
popad
|
||||
|
||||
pop ebp
|
||||
pop edi
|
||||
pop esi
|
||||
pop ebx
|
||||
}
|
||||
recEventTest();
|
||||
PCSX2_MEM_PROTECT_END()
|
||||
}
|
||||
|
||||
#else // _MSC_VER
|
||||
|
|
Loading…
Reference in New Issue