From ca3035fe07e75bab56653569547392a981c26829 Mon Sep 17 00:00:00 2001 From: "gregory.hainaut" Date: Sat, 22 Feb 2014 16:23:31 +0000 Subject: [PATCH] pcsx2: on going work to better support tlb miss Currenty code isn't activated because it will crash any game that do a tlb miss (with the recompiler) However if you activate the code with the interpreter, the exception will be fired and new tlb setting will be loaded => got nice picture with "Bouken Jidai Katsugeki" git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5911 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/R5900.cpp | 6 ++++++ pcsx2/vtlb.cpp | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/pcsx2/R5900.cpp b/pcsx2/R5900.cpp index f65eb032ed..63ad82a729 100644 --- a/pcsx2/R5900.cpp +++ b/pcsx2/R5900.cpp @@ -185,15 +185,20 @@ void cpuTlbMiss(u32 addr, u32 bd, u32 excode) Console.Error("cpuTlbMiss pc:%x, cycl:%x, addr: %x, status=%x, code=%x", cpuRegs.pc, cpuRegs.cycle, addr, cpuRegs.CP0.n.Status.val, excode); +#if 0 if (bd) Console.Warning("branch delay!!"); pxFail( "TLB Miss handler is uninished code." ); // temporary +#endif cpuRegs.CP0.n.BadVAddr = addr; cpuRegs.CP0.n.Context &= 0xFF80000F; cpuRegs.CP0.n.Context |= (addr >> 9) & 0x007FFFF0; cpuRegs.CP0.n.EntryHi = (addr & 0xFFFFE000) | (cpuRegs.CP0.n.EntryHi & 0x1FFF); + // Don't reinvent the wheel ;) + cpuException(excode, bd); +#if 0 cpuRegs.CP0.n.Cause = excode; if (!(cpuRegs.CP0.n.Status.val & 0x2)) { // EXL bit cpuRegs.CP0.n.EPC = cpuRegs.pc - 4; @@ -208,6 +213,7 @@ void cpuTlbMiss(u32 addr, u32 bd, u32 excode) cpuRegs.CP0.n.Status.b.EXL = 1; cpuUpdateOperationMode(); // Log=1; varLog|= 0x40000000; +#endif } void cpuTlbMissR(u32 addr, u32 bd) { diff --git a/pcsx2/vtlb.cpp b/pcsx2/vtlb.cpp index 9d7c35a183..8a70551380 100644 --- a/pcsx2/vtlb.cpp +++ b/pcsx2/vtlb.cpp @@ -334,7 +334,21 @@ template void vtlb_memWrite(u32 mem, mem32_t data); // Generates a tlbMiss Exception static __ri void vtlb_Miss(u32 addr,u32 mode) { + // Hack to handle expected tlb miss by some games. +#if 0 + if (mode) + cpuTlbMissW(addr, cpuRegs.branch); + else + cpuTlbMissR(addr, cpuRegs.branch); +#endif + + // The exception terminate the program on linux which is very annoying + // Just disable it for the moment +#ifdef __LINUX__ + if (0) +#else if( IsDevBuild ) +#endif Cpu->ThrowCpuException( R5900Exception::TLBMiss( addr, !!mode ) ); else { @@ -349,7 +363,13 @@ static __ri void vtlb_Miss(u32 addr,u32 mode) // time of the exception. static __ri void vtlb_BusError(u32 addr,u32 mode) { + // The exception terminate the program on linux which is very annoying + // Just disable it for the moment +#ifdef __LINUX__ + if (0) +#else if( IsDevBuild ) +#endif Cpu->ThrowCpuException( R5900Exception::BusError( addr, !!mode ) ); else Console.Error( R5900Exception::TLBMiss( addr, !!mode ).FormatMessage() );