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
This commit is contained in:
gregory.hainaut 2014-02-22 16:23:31 +00:00
parent 5af621056a
commit ca3035fe07
2 changed files with 26 additions and 0 deletions

View File

@ -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", Console.Error("cpuTlbMiss pc:%x, cycl:%x, addr: %x, status=%x, code=%x",
cpuRegs.pc, cpuRegs.cycle, addr, cpuRegs.CP0.n.Status.val, excode); cpuRegs.pc, cpuRegs.cycle, addr, cpuRegs.CP0.n.Status.val, excode);
#if 0
if (bd) Console.Warning("branch delay!!"); if (bd) Console.Warning("branch delay!!");
pxFail( "TLB Miss handler is uninished code." ); // temporary pxFail( "TLB Miss handler is uninished code." ); // temporary
#endif
cpuRegs.CP0.n.BadVAddr = addr; cpuRegs.CP0.n.BadVAddr = addr;
cpuRegs.CP0.n.Context &= 0xFF80000F; cpuRegs.CP0.n.Context &= 0xFF80000F;
cpuRegs.CP0.n.Context |= (addr >> 9) & 0x007FFFF0; cpuRegs.CP0.n.Context |= (addr >> 9) & 0x007FFFF0;
cpuRegs.CP0.n.EntryHi = (addr & 0xFFFFE000) | (cpuRegs.CP0.n.EntryHi & 0x1FFF); 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; cpuRegs.CP0.n.Cause = excode;
if (!(cpuRegs.CP0.n.Status.val & 0x2)) { // EXL bit if (!(cpuRegs.CP0.n.Status.val & 0x2)) { // EXL bit
cpuRegs.CP0.n.EPC = cpuRegs.pc - 4; 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; cpuRegs.CP0.n.Status.b.EXL = 1;
cpuUpdateOperationMode(); cpuUpdateOperationMode();
// Log=1; varLog|= 0x40000000; // Log=1; varLog|= 0x40000000;
#endif
} }
void cpuTlbMissR(u32 addr, u32 bd) { void cpuTlbMissR(u32 addr, u32 bd) {

View File

@ -334,7 +334,21 @@ template void vtlb_memWrite<mem32_t>(u32 mem, mem32_t data);
// Generates a tlbMiss Exception // Generates a tlbMiss Exception
static __ri void vtlb_Miss(u32 addr,u32 mode) 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 ) if( IsDevBuild )
#endif
Cpu->ThrowCpuException( R5900Exception::TLBMiss( addr, !!mode ) ); Cpu->ThrowCpuException( R5900Exception::TLBMiss( addr, !!mode ) );
else else
{ {
@ -349,7 +363,13 @@ static __ri void vtlb_Miss(u32 addr,u32 mode)
// time of the exception. // time of the exception.
static __ri void vtlb_BusError(u32 addr,u32 mode) 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 ) if( IsDevBuild )
#endif
Cpu->ThrowCpuException( R5900Exception::BusError( addr, !!mode ) ); Cpu->ThrowCpuException( R5900Exception::BusError( addr, !!mode ) );
else else
Console.Error( R5900Exception::TLBMiss( addr, !!mode ).FormatMessage() ); Console.Error( R5900Exception::TLBMiss( addr, !!mode ).FormatMessage() );