From d52f0fc9155a982f302c2592431315d4cade8423 Mon Sep 17 00:00:00 2001 From: LinesPrower Date: Sun, 4 Oct 2009 08:19:51 +0000 Subject: [PATCH] ExRAM iCache support in JIT IL git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4359 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Core/Core/Src/PowerPC/Jit64IL/JitAsm.cpp | 56 +++++++++++++------ 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/JitAsm.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/JitAsm.cpp index cccd2c2707..e070347492 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/JitAsm.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/JitAsm.cpp @@ -89,23 +89,8 @@ void AsmRoutineManager::Generate() MOV(32, R(EAX), M(&PowerPC::ppcState.pc)); dispatcherPcInEAX = GetCodePtr(); -#ifdef JIT_UNLIMITED_ICACHE - AND(32, R(EAX), Imm32(JIT_ICACHE_MASK)); -#ifdef _M_IX86 - MOV(32, R(EAX), MDisp(EAX, (u32)jit.GetBlockCache()->GetICache())); -#else - MOV(64, R(RSI), Imm64((u64)jit.GetBlockCache()->GetICache())); - MOV(32, R(EAX), MComplex(RSI, EAX, SCALE_1, 0)); -#endif -#else -#ifdef _M_IX86 - AND(32, R(EAX), Imm32(Memory::MEMVIEW32_MASK)); - MOV(32, R(EBX), Imm32((u32)Memory::base)); - MOV(32, R(EAX), MComplex(EBX, EAX, SCALE_1, 0)); -#else - MOV(32, R(EAX), MComplex(RBX, RAX, SCALE_1, 0)); -#endif -#endif + FixupBranch needinst = J(true); + const u8* haveinst = GetCodePtr(); TEST(32, R(EAX), Imm32(0xFC)); FixupBranch notfound = J_CC(CC_NZ); @@ -176,6 +161,43 @@ void AsmRoutineManager::Generate() ABI_PopAllCalleeSavedRegsAndAdjustStack(); RET(); + SetJumpTarget(needinst); +#ifdef JIT_UNLIMITED_ICACHE + + TEST(32, R(EAX), Imm32(JIT_ICACHE_EXRAM_BIT)); + FixupBranch exram = J_CC(CC_NZ); + + AND(32, R(EAX), Imm32(JIT_ICACHE_MASK)); +#ifdef _M_IX86 + MOV(32, R(EAX), MDisp(EAX, (u32)jit.GetBlockCache()->GetICache())); +#else + MOV(64, R(RSI), Imm64((u64)jit.GetBlockCache()->GetICache())); + MOV(32, R(EAX), MComplex(RSI, EAX, SCALE_1, 0)); +#endif + + FixupBranch getinst = J(); + SetJumpTarget(exram); + + AND(32, R(EAX), Imm32(JIT_ICACHEEX_MASK)); +#ifdef _M_IX86 + MOV(32, R(EAX), MDisp(EAX, (u32)jit.GetBlockCache()->GetICacheEx())); +#else + MOV(64, R(RSI), Imm64((u64)jit.GetBlockCache()->GetICacheEx())); + MOV(32, R(EAX), MComplex(RSI, EAX, SCALE_1, 0)); +#endif + + SetJumpTarget(getinst); +#else +#ifdef _M_IX86 + AND(32, R(EAX), Imm32(Memory::MEMVIEW32_MASK)); + MOV(32, R(EBX), Imm32((u32)Memory::base)); + MOV(32, R(EAX), MComplex(EBX, EAX, SCALE_1, 0)); +#else + MOV(32, R(EAX), MComplex(RBX, RAX, SCALE_1, 0)); +#endif +#endif + JMP(haveinst, true); + GenerateCommon(); }