Don't check that the pc is valid every single op.

This commit is contained in:
Unknown W. Brackets 2013-01-29 08:07:36 -08:00
parent bf80de9e8d
commit 661c7132c4
3 changed files with 29 additions and 5 deletions

View file

@ -602,11 +602,13 @@ void GLES_GPU::ExecuteOp(u32 op, u32 diff) {
case GE_CMD_CALL:
{
u32 retval = currentList->pc + 4;
u32 target = (((gstate.base & 0x00FF0000) << 8) | (op & 0xFFFFFC)) & 0xFFFFFFF;
if (stackptr == ARRAY_SIZE(stack)) {
ERROR_LOG(G3D, "CALL: Stack full!");
} else if (!Memory::IsValidAddress(target)) {
ERROR_LOG(G3D, "CALL to illegal address %08x - ignoring??", target);
} else {
stack[stackptr++] = retval;
u32 target = (((gstate.base & 0x00FF0000) << 8) | (op & 0xFFFFFC)) & 0xFFFFFFF;
currentList->pc = target - 4; // pc will be increased after we return, counteract that
}
}
@ -616,6 +618,11 @@ void GLES_GPU::ExecuteOp(u32 op, u32 diff) {
{
u32 target = (currentList->pc & 0xF0000000) | (stack[--stackptr] & 0x0FFFFFFF);
currentList->pc = target - 4;
if (!Memory::IsValidAddress(currentList->pc))
{
ERROR_LOG(G3D, "Invalid DL PC %08x on return", currentList->pc);
finished = true;
}
}
break;

View file

@ -64,13 +64,15 @@ bool GPUCommon::InterpretList(DisplayList &list)
u32 op = 0;
prev = 0;
finished = false;
if (!Memory::IsValidAddress(list.pc)) {
ERROR_LOG(G3D, "DL PC = %08x WTF!!!!", list.pc);
return true;
}
while (!finished)
{
list.status = PSP_GE_LIST_DRAWING;
if (!Memory::IsValidAddress(list.pc)) {
ERROR_LOG(G3D, "DL PC = %08x WTF!!!!", list.pc);
return true;
}
if (list.pc == list.stall)
{
list.status = PSP_GE_LIST_STALL_REACHED;

View file

@ -108,6 +108,11 @@ void NullGPU::ExecuteOp(u32 op, u32 diff)
u32 target = (((gstate.base & 0x00FF0000) << 8) | (op & 0xFFFFFC)) & 0x0FFFFFFF;
DEBUG_LOG(G3D,"DL CMD JUMP - %08x to %08x", currentList->pc, target);
currentList->pc = target - 4; // pc will be increased after we return, counteract that
if (!Memory::IsValidAddress(currentList->pc))
{
ERROR_LOG(G3D, "Invalid DL PC %08x on jump", currentList->pc);
finished = true;
}
}
break;
@ -118,6 +123,11 @@ void NullGPU::ExecuteOp(u32 op, u32 diff)
u32 target = (((gstate.base & 0x00FF0000) << 8) | (op & 0xFFFFFC)) & 0xFFFFFFF;
DEBUG_LOG(G3D,"DL CMD CALL - %08x to %08x, ret=%08x", currentList->pc, target, retval);
currentList->pc = target - 4; // pc will be increased after we return, counteract that
if (!Memory::IsValidAddress(currentList->pc))
{
ERROR_LOG(G3D, "Invalid DL PC %08x on call", currentList->pc);
finished = true;
}
}
break;
@ -127,6 +137,11 @@ void NullGPU::ExecuteOp(u32 op, u32 diff)
u32 target = stack[--stackptr] & 0xFFFFFFF;
DEBUG_LOG(G3D,"DL CMD RET - from %08x to %08x", currentList->pc, target);
currentList->pc = target - 4;
if (!Memory::IsValidAddress(currentList->pc))
{
ERROR_LOG(G3D, "Invalid DL PC %08x on return", currentList->pc);
finished = true;
}
}
break;