Jit: Add missing instruction address check from ARM jits

This commit is contained in:
Henrik Rydgård
2026-02-26 09:58:30 +01:00
parent c953814fe0
commit 749e3a02cb
3 changed files with 16 additions and 8 deletions
+5 -3
View File
@@ -100,8 +100,7 @@ static u32 JitMemCheck(u32 pc) {
return coreState == CORE_RUNNING_CPU || coreState == CORE_NEXTFRAME ? 0 : 1;
}
namespace MIPSComp
{
namespace MIPSComp {
using namespace ArmGen;
using namespace ArmJitConstants;
@@ -244,7 +243,10 @@ void ArmJit::CompileDelaySlot(int flags) {
void ArmJit::Compile(u32 em_address) {
PROFILE_THIS_SCOPE("jitc");
// INFO_LOG(Log::JIT, "Compiling at %08x", em_address);
if (!Memory::IsValid4AlignedAddress(em_address)) {
Core_ExecException(em_address, em_address, ExecExceptionType::JUMP);
return;
}
if (GetSpaceLeft() < 0x10000 || blocks.IsFull()) {
ClearCache();
+6 -1
View File
@@ -242,6 +242,12 @@ void Arm64Jit::CompileDelaySlot(int flags) {
void Arm64Jit::Compile(u32 em_address) {
PROFILE_THIS_SCOPE("jitc");
if (!Memory::IsValid4AlignedAddress(em_address)) {
Core_ExecException(em_address, em_address, ExecExceptionType::JUMP);
return;
}
if (GetSpaceLeft() < 0x10000 || blocks.IsFull()) {
INFO_LOG(Log::JIT, "Space left: %d", (int)GetSpaceLeft());
ClearCache();
@@ -249,7 +255,6 @@ void Arm64Jit::Compile(u32 em_address) {
BeginWrite(JitBlockCache::MAX_BLOCK_INSTRUCTIONS * 16);
// To debug really wacky JIT issues, it can be a good idea to bisect the block number,
// and disable parts of the jit using jo.disableFlags for certain ranges of blocks.
+5 -4
View File
@@ -300,15 +300,16 @@ void Jit::EatInstruction(MIPSOpcode op) {
void Jit::Compile(u32 em_address) {
PROFILE_THIS_SCOPE("jitc");
if (GetSpaceLeft() < 0x10000 || blocks.IsFull()) {
ClearCache();
}
if (!Memory::IsValidAddress(em_address) || (em_address & 3) != 0) {
if (!Memory::IsValid4AlignedAddress(em_address)) {
Core_ExecException(em_address, em_address, ExecExceptionType::JUMP);
return;
}
if (GetSpaceLeft() < 0x10000 || blocks.IsFull()) {
ClearCache();
}
// Sometimes we compile fairly large blocks, although it's uncommon.
BeginWrite(JitBlockCache::MAX_BLOCK_INSTRUCTIONS * 16);