Fix Lit Pools for cases where offset goes out of range. For example: Zero no Kiseki has a block that is 7K large.

This commit is contained in:
Sacha 2013-03-04 14:36:23 +10:00
parent 9633239f18
commit 0fc6b60874
4 changed files with 24 additions and 5 deletions

View File

@ -143,16 +143,23 @@ void ARMXEmitter::AddNewLit(u32 val)
currentLitPool.push_back(pool_item);
}
void ARMXEmitter::MOVI2R(ARMReg reg, u32 val)
void ARMXEmitter::MOVI2R(ARMReg reg, u32 val, bool optimize)
{
Operand2 op2;
bool inverse;
if (TryMakeOperand2_AllowInverse(val, op2, &inverse)) {
if (cpu_info.bArmV7 && !optimize)
{
// For backpatching on ARMv7
MOVW(reg, val & 0xFFFF);
MOVT(reg, val, true);
}
else if (TryMakeOperand2_AllowInverse(val, op2, &inverse)) {
inverse ? MVN(reg, op2) : MOV(reg, op2);
} else {
if (cpu_info.bArmV7)
{
// Wse MOVW+MOVT for ARMv7+
// Use MOVW+MOVT for ARMv7+
MOVW(reg, val & 0xFFFF);
if(val & 0xFFFF0000)
MOVT(reg, val, true);

View File

@ -391,6 +391,7 @@ public:
void FlushLitPool();
void AddNewLit(u32 val);
CCFlags GetCC() { return CCFlags(condition >> 28); }
void SetCC(CCFlags cond = CC_AL);
// Special purpose instructions

View File

@ -197,8 +197,8 @@ void Jit::GenerateFixedCode()
// INFO_LOG(HLE, "END OF THE DISASM ========================");
// Don't forget to zap the instruction cache!
FlushIcache();
FlushLitPool();
FlushIcache();
}
} // namespace

View File

@ -25,6 +25,7 @@
#include "ArmRegCache.h"
#include "ArmJit.h"
#include "CPUDetect.h"
#include "../../../ext/disarm.h"
@ -218,6 +219,16 @@ const u8 *Jit::DoJit(u32 em_address, ArmJitBlock *b)
js.compilerPC += 4;
numInstructions++;
if (!cpu_info.bArmV7 && GetCodePtr() - b->checkedEntry >= 4088)
{
// We need to prematurely flush as we are out of range
CCFlags old_cc = GetCC();
SetCC(CC_AL);
FixupBranch skip = B();
FlushLitPool();
SetJumpTarget(skip);
SetCC(old_cc);
}
}
FlushLitPool();
#ifdef LOGASM
@ -346,7 +357,7 @@ void Jit::Comp_DoNothing(u32 op) { }
#define _FS ((op>>11) & 0x1F)
#define _FT ((op>>16) & 0x1F)
#define _FD ((op>>6) & 0x1F)
#define _POS ((op>>6) & 0x1F)
#define _POS((op>>6) & 0x1F)
#define _SIZE ((op>>11) & 0x1F)
//memory regions: