JitArm64: Fix dispatcher with MMU.

This commit is contained in:
degasus 2016-05-19 19:41:56 +02:00
parent 8e902abca3
commit c5e8238cc7
1 changed files with 30 additions and 6 deletions

View File

@ -5,6 +5,7 @@
#include "Common/Arm64Emitter.h" #include "Common/Arm64Emitter.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/JitRegister.h" #include "Common/JitRegister.h"
#include "Common/MathUtil.h"
#include "Core/CoreTiming.h" #include "Core/CoreTiming.h"
#include "Core/HW/Memmap.h" #include "Core/HW/Memmap.h"
#include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PowerPC.h"
@ -46,14 +47,36 @@ void JitArm64::GenerateAsm()
dispatcherNoCheck = GetCodePtr(); dispatcherNoCheck = GetCodePtr();
STR(INDEX_UNSIGNED, DISPATCHER_PC, PPC_REG, PPCSTATE_OFF(pc)); FixupBranch exram, vmem, not_exram, not_vmem;
ARM64Reg pc_masked = W25;
ARM64Reg cache_base = X27;
// This block of code gets the address of the compiled block of code // VMEM
// It runs though to the compiling portion if it isn't found not_vmem = TBZ(DISPATCHER_PC, IntLog2(JIT_ICACHE_VMEM_BIT));
BFM(DISPATCHER_PC, WSP, 3, 2); // Wipe the top 3 bits. Same as PC & JIT_ICACHE_MASK ANDI2R(pc_masked, DISPATCHER_PC, JIT_ICACHE_MASK);
MOVI2R(cache_base, (u64)jit->GetBlockCache()->iCacheVMEM.data());
vmem = B();
SetJumpTarget(not_vmem);
MOVI2R(X27, (u64)jit->GetBlockCache()->iCache.data()); if (SConfig::GetInstance().bWii)
LDR(W27, X27, EncodeRegTo64(DISPATCHER_PC)); {
// Wii EX-RAM
not_exram = TBZ(DISPATCHER_PC, IntLog2(JIT_ICACHE_EXRAM_BIT));
ANDI2R(pc_masked, DISPATCHER_PC, JIT_ICACHEEX_MASK);
MOVI2R(cache_base, (u64)jit->GetBlockCache()->iCacheEx.data());
exram = B();
SetJumpTarget(not_exram);
}
// Common memory
ANDI2R(pc_masked, DISPATCHER_PC, JIT_ICACHE_MASK);
MOVI2R(cache_base, (u64)jit->GetBlockCache()->iCache.data());
SetJumpTarget(vmem);
if (SConfig::GetInstance().bWii)
SetJumpTarget(exram);
LDR(W27, cache_base, EncodeRegTo64(pc_masked));
FixupBranch JitBlock = TBNZ(W27, 7); // Test the 7th bit FixupBranch JitBlock = TBNZ(W27, 7); // Test the 7th bit
// Success, it is our Jitblock. // Success, it is our Jitblock.
@ -65,6 +88,7 @@ void JitArm64::GenerateAsm()
SetJumpTarget(JitBlock); SetJumpTarget(JitBlock);
STR(INDEX_UNSIGNED, DISPATCHER_PC, PPC_REG, PPCSTATE_OFF(pc));
MOVI2R(X30, (u64)&::Jit); MOVI2R(X30, (u64)&::Jit);
BLR(X30); BLR(X30);