mirror of https://github.com/PCSX2/pcsx2.git
Linux: Fix Final Fantasy XII. (memcmp_mmx appeared to be freezing MMX and not thawing it, and it didn't freeze it in Windows.) Comment out some unused code. Remove some code I commented earlier. And consolidate some of the calls to FreezeXMMRegs/FreezeMMXRegs.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@757 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
378a84658c
commit
12cd3f8b6c
|
@ -184,11 +184,9 @@ void __fastcall WriteFIFO_page_6(u32 mem, const mem128_t *value)
|
|||
}
|
||||
else
|
||||
{
|
||||
FreezeXMMRegs(1);
|
||||
FreezeMMXRegs(1);
|
||||
FreezeRegs(1);
|
||||
GSGIFTRANSFER3((u32*)value, 1);
|
||||
FreezeMMXRegs(0);
|
||||
FreezeXMMRegs(0);
|
||||
FreezeRegs(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -220,14 +220,12 @@ void GIFdma()
|
|||
// When MTGS is enabled, Gifchain calls WRITERING_DMA, which calls GSRINGBUF_DONECOPY, which freezes
|
||||
// the registers inside of the FreezeXMMRegs calls here and in the other two below..
|
||||
// I'm not really sure that is intentional. --arcum42
|
||||
FreezeXMMRegs(1);
|
||||
FreezeMMXRegs(1);
|
||||
FreezeRegs(1);
|
||||
GIFchain();
|
||||
FreezeXMMRegs(0); // Theres a comment below that says not to unfreeze the xmm regs, so not sure about this.
|
||||
FreezeMMXRegs(0);
|
||||
FreezeRegs(0); // Theres a comment below that says not to unfreeze the xmm regs, so not sure about this.
|
||||
|
||||
if((gspath3done == 1 || (gif->chcr & 0xc) == 0) && gif->qwc == 0){
|
||||
if(gif->qwc > 0) SysPrintf("Horray\n");
|
||||
if(gif->qwc > 0) SysPrintf("Hurray\n");
|
||||
gspath3done = 0;
|
||||
gif->chcr &= ~0x100;
|
||||
//psHu32(GIF_MODE)&= ~0x4;
|
||||
|
@ -248,11 +246,9 @@ void GIFdma()
|
|||
if ((psHu32(DMAC_CTRL) & 0xC0) == 0x80 && (gif->chcr & 0xc) == 0) {
|
||||
SysPrintf("DMA Stall Control on GIF normal\n");
|
||||
}
|
||||
FreezeXMMRegs(1);
|
||||
FreezeMMXRegs(1);
|
||||
FreezeRegs(1);
|
||||
GIFchain(); //Transfers the data set by the switch
|
||||
FreezeXMMRegs(0);
|
||||
FreezeMMXRegs(0);
|
||||
FreezeRegs(0);
|
||||
if(gif->qwc == 0 && (gif->chcr & 0xc) == 0) gspath3done = 1;
|
||||
return;
|
||||
}
|
||||
|
@ -298,12 +294,9 @@ void GIFdma()
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
FreezeXMMRegs(1);
|
||||
FreezeMMXRegs(1);
|
||||
FreezeRegs(1);
|
||||
GIFchain(); //Transfers the data set by the switch
|
||||
FreezeXMMRegs(0);
|
||||
FreezeMMXRegs(0);
|
||||
FreezeRegs(0);
|
||||
|
||||
if ((gif->chcr & 0x80) && ptag[0] >> 31) { //Check TIE bit of CHCR and IRQ bit of tag
|
||||
GIF_LOG("dmaIrq Set\n");
|
||||
|
@ -534,15 +527,13 @@ void mfifoGIFtransfer(int qwc) {
|
|||
gifmfifoirq = 1;
|
||||
}
|
||||
}
|
||||
FreezeXMMRegs(1);
|
||||
FreezeMMXRegs(1);
|
||||
FreezeRegs(1);
|
||||
if (mfifoGIFchain() == -1) {
|
||||
SysPrintf("GIF dmaChain error size=%d, madr=%lx, tadr=%lx\n",
|
||||
gif->qwc, gif->madr, gif->tadr);
|
||||
gifstate = GIF_STATE_STALL;
|
||||
}
|
||||
FreezeXMMRegs(0);
|
||||
FreezeMMXRegs(0);
|
||||
FreezeRegs(0);
|
||||
|
||||
if(gif->qwc == 0 && gifstate == GIF_STATE_DONE) gifstate = GIF_STATE_STALL;
|
||||
CPU_INT(11,mfifocycles);
|
||||
|
|
|
@ -153,7 +153,7 @@ void psxDma10(u32 madr, u32 bcr, u32 chcr) {
|
|||
psHu32(0x1000F240) &= ~0x40;
|
||||
psHu32(0x1000F240) &= ~0x100;
|
||||
psHu32(0x1000F240) &= ~0x4000;
|
||||
FreezeXMMRegs(0);
|
||||
FreezeXMMRegs(0)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -677,16 +677,14 @@ int mtgsThreadObject::Callback()
|
|||
void mtgsThreadObject::WaitGS()
|
||||
{
|
||||
// Freeze registers because some kernel code likes to destroy them
|
||||
FreezeXMMRegs(1);
|
||||
FreezeMMXRegs(1);
|
||||
FreezeRegs(1);
|
||||
SetEvent();
|
||||
while( volatize(m_RingPos) != volatize(m_WritePos) )
|
||||
{
|
||||
Timeslice();
|
||||
//SpinWait();
|
||||
}
|
||||
FreezeXMMRegs(0);
|
||||
FreezeMMXRegs(0);
|
||||
FreezeRegs(0);
|
||||
}
|
||||
|
||||
// Sets the gsEvent flag and releases a timeslice.
|
||||
|
@ -701,8 +699,7 @@ void mtgsThreadObject::SetEvent()
|
|||
void mtgsThreadObject::PrepEventWait()
|
||||
{
|
||||
// Freeze registers because some kernel code likes to destroy them
|
||||
FreezeXMMRegs(1);
|
||||
FreezeMMXRegs(1);
|
||||
FreezeRegs(1);
|
||||
//Console::Notice( "MTGS Stall! EE waits for nothing! ... except your GPU sometimes." );
|
||||
SetEvent();
|
||||
Timeslice();
|
||||
|
@ -710,8 +707,7 @@ void mtgsThreadObject::PrepEventWait()
|
|||
|
||||
void mtgsThreadObject::PostEventWait() const
|
||||
{
|
||||
FreezeMMXRegs(0);
|
||||
FreezeXMMRegs(0);
|
||||
FreezeRegs(0);
|
||||
}
|
||||
|
||||
u8* mtgsThreadObject::GetDataPacketPtr() const
|
||||
|
@ -770,12 +766,10 @@ void mtgsThreadObject::SendDataPacket()
|
|||
m_CopyDataTally += m_packet_size;
|
||||
if( ( m_CopyDataTally > 0x8000 ) || ( ++m_CopyCommandTally > 16 ) )
|
||||
{
|
||||
FreezeXMMRegs(1);
|
||||
FreezeMMXRegs(1);
|
||||
FreezeRegs(1);
|
||||
//Console::Status( "MTGS Kick! DataSize : 0x%5.8x, CommandTally : %d", m_CopyDataTally, m_CopyCommandTally );
|
||||
SetEvent();
|
||||
FreezeMMXRegs(0);
|
||||
FreezeXMMRegs(0);
|
||||
FreezeRegs(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -721,7 +721,7 @@ void ProcessFKeys(int fkey, int shift)
|
|||
}
|
||||
}
|
||||
|
||||
void injectIRX(const char *filename)
|
||||
/*void injectIRX(const char *filename)
|
||||
{
|
||||
char name[260], *p, *q;
|
||||
struct romdir *rd;
|
||||
|
@ -785,7 +785,7 @@ void injectIRX(const char *filename)
|
|||
memcpy(rd[i].fileName, name, strlen(name));
|
||||
rd[i].fileSize=filesize;
|
||||
rd[i].extInfoSize=0;
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
void _memset16_unaligned( void* dest, u16 data, size_t size )
|
||||
|
|
|
@ -69,9 +69,11 @@ extern bool g_EEFreezeRegs;
|
|||
#ifndef __INTEL_COMPILER
|
||||
extern "C" void FreezeXMMRegs_(int save);
|
||||
extern "C" void FreezeMMXRegs_(int save);
|
||||
extern "C" void FreezeRegs(int save);
|
||||
#else
|
||||
extern void FreezeXMMRegs_(int save);
|
||||
extern void FreezeMMXRegs_(int save);
|
||||
extern void FreezeRegs(int save);
|
||||
#endif
|
||||
|
||||
// these macros check to see if needs freezing
|
||||
|
|
|
@ -1534,11 +1534,9 @@ static int __fastcall Vif1TransDirectHL(u32 *data){
|
|||
}
|
||||
else
|
||||
{
|
||||
FreezeXMMRegs(1);
|
||||
FreezeMMXRegs(1);
|
||||
FreezeRegs(1);
|
||||
GSGIFTRANSFER2((u32*)splittransfer[0], 1);
|
||||
FreezeMMXRegs(0);
|
||||
FreezeXMMRegs(0);
|
||||
FreezeRegs(0);
|
||||
}
|
||||
|
||||
if(vif1.tag.size == 0) vif1.cmd = 0;
|
||||
|
@ -1576,12 +1574,9 @@ static int __fastcall Vif1TransDirectHL(u32 *data){
|
|||
mtgsThread->SendDataPacket();
|
||||
}
|
||||
else {
|
||||
|
||||
FreezeXMMRegs(1);
|
||||
FreezeMMXRegs(1);
|
||||
FreezeRegs(1);
|
||||
GSGIFTRANSFER2(data, (ret >> 2));
|
||||
FreezeMMXRegs(0);
|
||||
FreezeXMMRegs(0);
|
||||
FreezeRegs(0);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -2128,9 +2123,7 @@ void dmaVIF1()
|
|||
vif1ch->madr += vif1ch->qwc * 16; // mgs3 scene changes
|
||||
vif1ch->qwc = 0;
|
||||
CPU_INT(1, g_vifCycles);
|
||||
|
||||
}
|
||||
|
||||
vif1.done = 1;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -44,11 +44,11 @@
|
|||
memcmp_mmx:
|
||||
// make sure mmx regs are stored
|
||||
// FreezeMMXRegs(1);
|
||||
cmp dword ptr [g_EEFreezeRegs], 0
|
||||
je memcmp_mmx_begin
|
||||
push 1
|
||||
call FreezeMMXRegs_
|
||||
add esp, 4
|
||||
//cmp dword ptr [g_EEFreezeRegs], 0
|
||||
//je memcmp_mmx_begin
|
||||
//push 1
|
||||
//call FreezeMMXRegs_
|
||||
//add esp, 4
|
||||
|
||||
memcmp_mmx_begin:
|
||||
push esi
|
||||
|
|
|
@ -29,11 +29,6 @@
|
|||
extern u32 g_vif1Masks[48], g_vif0Masks[48];
|
||||
extern u32 g_vif1HasMask3[4], g_vif0HasMask3[4];
|
||||
|
||||
//static const u32 writearr[4] = { 0xffffffff, 0, 0, 0 };
|
||||
//static const u32 rowarr[4] = { 0, 0xffffffff, 0, 0 };
|
||||
//static const u32 colarr[4] = { 0, 0, 0xffffffff, 0 };
|
||||
//static const u32 updatearr[4] = {0xffffffff, 0xffffffff, 0xffffffff, 0 };
|
||||
|
||||
// arranged in writearr, rowarr, colarr, updatearr
|
||||
static PCSX2_ALIGNED16(u32 s_maskarr[16][4]) = {
|
||||
0xffffffff, 0x00000000, 0x00000000, 0xffffffff,
|
||||
|
@ -58,8 +53,6 @@ extern u8 s_maskwrite[256];
|
|||
|
||||
extern "C" PCSX2_ALIGNED16(u32 s_TempDecompress[4]) = {0};
|
||||
|
||||
//#if defined(_MSC_VER)
|
||||
|
||||
void __fastcall SetNewMask(u32* vif1masks, u32* hasmask, u32 mask, u32 oldmask)
|
||||
{
|
||||
u32 i;
|
||||
|
@ -67,7 +60,7 @@ void __fastcall SetNewMask(u32* vif1masks, u32* hasmask, u32 mask, u32 oldmask)
|
|||
FreezeXMMRegs(1);
|
||||
for(i = 0; i < 4; ++i, mask >>= 8, oldmask >>= 8, vif1masks += 16) {
|
||||
|
||||
prev |= s_maskwrite[mask&0xff];//((mask&3)==3)||((mask&0xc)==0xc)||((mask&0x30)==0x30)||((mask&0xc0)==0xc0);
|
||||
prev |= s_maskwrite[mask&0xff];
|
||||
hasmask[i] = prev;
|
||||
|
||||
if( (mask&0xff) != (oldmask&0xff) ) {
|
||||
|
@ -93,46 +86,3 @@ void __fastcall SetNewMask(u32* vif1masks, u32* hasmask, u32 mask, u32 oldmask)
|
|||
}
|
||||
FreezeXMMRegs(0);
|
||||
}
|
||||
|
||||
|
||||
/*#else // gcc
|
||||
// Is this really supposed to be assembly for gcc and C for Windows?
|
||||
void __fastcall SetNewMask(u32* vif1masks, u32* hasmask, u32 mask, u32 oldmask)
|
||||
{
|
||||
u32 i;
|
||||
u32 prev = 0;
|
||||
FreezeXMMRegs(1);
|
||||
|
||||
for(i = 0; i < 4; ++i, mask >>= 8, oldmask >>= 8, vif1masks += 16) {
|
||||
|
||||
prev |= s_maskwrite[mask&0xff];//((mask&3)==3)||((mask&0xc)==0xc)||((mask&0x30)==0x30)||((mask&0xc0)==0xc0);
|
||||
hasmask[i] = prev;
|
||||
|
||||
if( (mask&0xff) != (oldmask&0xff) ) {
|
||||
u8* p0 = (u8*)&s_maskarr[mask&15][0];
|
||||
u8* p1 = (u8*)&s_maskarr[(mask>>4)&15][0];
|
||||
|
||||
__asm__(".intel_syntax noprefix\n"
|
||||
"movaps xmm0, [%0]\n"
|
||||
"movaps xmm1, [%1]\n"
|
||||
"movaps xmm2, xmm0\n"
|
||||
"punpcklwd xmm0, xmm0\n"
|
||||
"punpckhwd xmm2, xmm2\n"
|
||||
"movaps xmm3, xmm1\n"
|
||||
"punpcklwd xmm1, xmm1\n"
|
||||
"punpckhwd xmm3, xmm3\n"
|
||||
"movq [%2], xmm0\n"
|
||||
"movq [%2+8], xmm1\n"
|
||||
"movhps [%2+16], xmm0\n"
|
||||
"movhps [%2+24], xmm1\n"
|
||||
"movq [%2+32], xmm2\n"
|
||||
"movq [%2+40], xmm3\n"
|
||||
"movhps [%2+48], xmm2\n"
|
||||
"movhps [%2+56], xmm3\n"
|
||||
".att_syntax\n" : : "r"(p0), "r"(p1), "r"(vif1masks) );
|
||||
}
|
||||
}
|
||||
FreezeXMMRegs(0);
|
||||
}
|
||||
|
||||
#endif*/
|
||||
|
|
|
@ -613,9 +613,12 @@ void recStep( void ) {
|
|||
static __forceinline bool recEventTest()
|
||||
{
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
// dont' remove this check unless doing an official release
|
||||
if( g_globalXMMSaved || g_globalMMXSaved)
|
||||
// dont' remove this check unless doing an official release
|
||||
if( g_globalXMMSaved || g_globalMMXSaved)
|
||||
{
|
||||
DevCon::Error("Pcsx2 Foopah! Frozen regs have not been restored!!!");
|
||||
DevCon::Error("g_globalXMMSaved = %d,g_globalMMXSaved = %d",params g_globalXMMSaved, g_globalMMXSaved);
|
||||
}
|
||||
assert( !g_globalXMMSaved && !g_globalMMXSaved);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -72,15 +72,23 @@ void SetCPUState(u32 sseMXCSR, u32 sseVUMXCSR)
|
|||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
__forceinline void FreezeRegs(int save)
|
||||
{
|
||||
FreezeXMMRegs(save);
|
||||
FreezeMMXRegs(save);
|
||||
}
|
||||
|
||||
__forceinline void FreezeMMXRegs_(int save)
|
||||
{
|
||||
//DevCon::Notice("FreezeMMXRegs_(%d); [%d]\n", save, g_globalMMXSaved);
|
||||
assert( g_EEFreezeRegs );
|
||||
|
||||
if( save ) {
|
||||
g_globalMMXSaved++;
|
||||
if( g_globalMMXSaved>1 )
|
||||
{
|
||||
//SysPrintf("MMX Already Saved!\n");
|
||||
//DevCon::Notice("MMX Already Saved!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -117,7 +125,7 @@ __forceinline void FreezeMMXRegs_(int save)
|
|||
else {
|
||||
if( g_globalMMXSaved==0 )
|
||||
{
|
||||
//SysPrintf("MMX Not Saved!\n");
|
||||
//DevCon::Notice("MMX Not Saved!\n");
|
||||
return;
|
||||
}
|
||||
g_globalMMXSaved--;
|
||||
|
@ -159,14 +167,14 @@ __forceinline void FreezeMMXRegs_(int save)
|
|||
// XMM Register Freezing
|
||||
__forceinline void FreezeXMMRegs_(int save)
|
||||
{
|
||||
//SysPrintf("FreezeXMMRegs_(%d); [%d]\n", save, g_globalXMMSaved);
|
||||
//DevCon::Notice("FreezeXMMRegs_(%d); [%d]\n", save, g_globalXMMSaved);
|
||||
assert( g_EEFreezeRegs );
|
||||
|
||||
if( save )
|
||||
{
|
||||
g_globalXMMSaved++;
|
||||
if( g_globalXMMSaved > 1 ){
|
||||
//SysPrintf("XMM Already saved\n");
|
||||
//DevCon::Notice("XMM Already saved\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -204,7 +212,7 @@ __forceinline void FreezeXMMRegs_(int save)
|
|||
{
|
||||
if( g_globalXMMSaved==0 )
|
||||
{
|
||||
//SysPrintf("XMM Regs not saved!\n");
|
||||
//DevCon::Notice("XMM Regs not saved!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue