mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 21:39:52 +00:00
x86jit: Trigger exec exceptions.
A common case might be, you're hacking something in the game and you broke the stack, so you `jr ra` into outer space.
This commit is contained in:
parent
3c34c7c456
commit
b3bf61dde1
@ -20,8 +20,9 @@
|
||||
|
||||
#include "profiler/profiler.h"
|
||||
|
||||
#include "Core/Reporting.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/Reporting.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/HLETables.h"
|
||||
#include "Core/Host.h"
|
||||
@ -591,6 +592,10 @@ void Jit::Comp_VBranch(MIPSOpcode op)
|
||||
}
|
||||
}
|
||||
|
||||
static void HitInvalidJump(uint32_t dest) {
|
||||
Core_ExecException(dest, currentMIPS->pc - 8, ExecExceptionType::JUMP);
|
||||
}
|
||||
|
||||
void Jit::Comp_Jump(MIPSOpcode op) {
|
||||
CONDITIONAL_LOG;
|
||||
if (js.inDelaySlot) {
|
||||
@ -608,6 +613,12 @@ void Jit::Comp_Jump(MIPSOpcode op) {
|
||||
js.compiling = false;
|
||||
}
|
||||
// TODO: Mark this block dirty or something? May be indication it will be changed by imports.
|
||||
|
||||
CompileDelaySlot(DELAYSLOT_NICE);
|
||||
FlushAll();
|
||||
MOV(32, MIPSSTATE_VAR(pc), Imm32(GetCompilerPC() + 8));
|
||||
ABI_CallFunctionC((const void *)&HitInvalidJump, targetAddr);
|
||||
WriteSyscallExit();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -705,6 +705,11 @@ void Jit::WriteExit(u32 destination, int exit_num) {
|
||||
}
|
||||
}
|
||||
|
||||
static void HitInvalidJumpReg(uint32_t source) {
|
||||
Core_ExecException(currentMIPS->pc, source, ExecExceptionType::JUMP);
|
||||
currentMIPS->pc = source + 8;
|
||||
}
|
||||
|
||||
void Jit::WriteExitDestInReg(X64Reg reg) {
|
||||
// If we need to verify coreState and rewind, we may not jump yet.
|
||||
if (js.afterOp & (JitState::AFTER_CORE_STATE | JitState::AFTER_REWIND_PC_BAD_STATE)) {
|
||||
@ -741,15 +746,13 @@ void Jit::WriteExitDestInReg(X64Reg reg) {
|
||||
SetJumpTarget(tooLow);
|
||||
SetJumpTarget(tooHigh);
|
||||
|
||||
ABI_CallFunctionA((const void *)&Memory::GetPointer, R(reg));
|
||||
ABI_CallFunctionA((const void *)&Memory::IsValidAddress, R(reg));
|
||||
|
||||
// If we're ignoring, coreState didn't trip - so trip it now.
|
||||
if (g_Config.bIgnoreBadMemAccess) {
|
||||
CMP(32, R(EAX), Imm32(0));
|
||||
FixupBranch skip = J_CC(CC_NE);
|
||||
ABI_CallFunctionA((const void *)&Core_UpdateState, Imm32(CORE_RUNTIME_ERROR));
|
||||
SetJumpTarget(skip);
|
||||
}
|
||||
CMP(32, R(EAX), Imm32(0));
|
||||
FixupBranch skip = J_CC(CC_NE);
|
||||
ABI_CallFunctionC((const void *)&HitInvalidJumpReg, GetCompilerPC());
|
||||
SetJumpTarget(skip);
|
||||
|
||||
SUB(32, MIPSSTATE_VAR(downcount), Imm8(0));
|
||||
JMP(dispatcherCheckCoreState, true);
|
||||
|
Loading…
Reference in New Issue
Block a user