From f4404bc1d18195ed3f2f1737c2d5dfd77da8efea Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Thu, 29 Jan 2009 06:04:37 +0000 Subject: [PATCH] Made a quick hackfix that should solve TlbMiss crashes in a few games, such as .Hack/GU (Issue 87). The real problem is that the VifDma1 happily overwrites past the end of VU1 memory, which spills over into the EE's recLUT tables, which causes rapid death. I fixed it by allocating an extra "cushion" of data at the end of VU1 memory. git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@652 a6443dda-0b58-4228-96e9-037be469359c --- pcsx2/VUmicroMem.cpp | 11 +++++++++-- pcsx2/VifDma.cpp | 8 ++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/pcsx2/VUmicroMem.cpp b/pcsx2/VUmicroMem.cpp index fe1352c355..cb2af6a1cc 100644 --- a/pcsx2/VUmicroMem.cpp +++ b/pcsx2/VUmicroMem.cpp @@ -132,10 +132,17 @@ void vuMicroMemAlloc() g_pVU1 = (VURegs*)(VU0.Mem + 0x4000); - VU1.Mem = (u8*)_aligned_malloc(16*1024*2, 16); + // HACKFIX! (Air) + // The VIFdma1 has a nasty habit of transferring data into the 4k page of memory above + // the VU1. (oops!!) This happens to be recLUT most of the time, which causes rapid death + // of our emulator. So we allocate some extra space here to keep VIF1 a little happier. + + // fixme - When the VIF is fixed, change the *3 below back to an *2. + + VU1.Mem = (u8*)_aligned_malloc(0x4000*3, 16); if (VU1.Mem == NULL ) throw Exception::OutOfMemory( "vu1Init > Failed to allocate memory for the VU1micro." ); - VU1.Micro = VU1.Mem + 16*1024; //(u8*)_aligned_malloc(16*1024, 16); + VU1.Micro = VU1.Mem + 0x4000; //(u8*)_aligned_malloc(16*1024, 16); } if( VU0.Micro == NULL ) diff --git a/pcsx2/VifDma.cpp b/pcsx2/VifDma.cpp index 8693a2d269..c709895ef2 100644 --- a/pcsx2/VifDma.cpp +++ b/pcsx2/VifDma.cpp @@ -1523,9 +1523,7 @@ static int Vif1TransSTRow(u32 *data){ case 3: pmem[8] = data[2]; pmem2[2] = data[2]; case 2: pmem[4] = data[1]; pmem2[1] = data[1]; case 1: pmem[0] = data[0]; pmem2[0] = data[0]; break; -#ifdef _MSC_VER - default: __assume(0); -#endif + jNO_DEFAULT; } vif1.tag.addr += ret; vif1.tag.size -= ret; @@ -1545,9 +1543,7 @@ static int Vif1TransSTCol(u32 *data){ case 3: pmem[8] = data[2]; pmem2[2] = data[2]; case 2: pmem[4] = data[1]; pmem2[1] = data[1]; case 1: pmem[0] = data[0]; pmem2[0] = data[0]; break; -#ifdef _MSC_VER - default: __assume(0); -#endif + jNO_DEFAULT; } vif1.tag.addr += ret; vif1.tag.size -= ret;