Merge pull request #4649 from degasus/PIE

Jit64: Use PPCSTATE reg if possible.
This commit is contained in:
Matthew Parlane 2017-01-13 08:57:47 +13:00 committed by GitHub
commit f033de6a30
2 changed files with 7 additions and 6 deletions

View File

@ -362,7 +362,7 @@ void Jit64::DoMergedBranch()
if (next.OPCD == 16) // bcx
{
if (next.LK)
MOV(32, M(&LR), Imm32(nextPC + 4));
MOV(32, PPCSTATE(spr[SPR_LR]), Imm32(nextPC + 4));
u32 destination;
if (next.AA)
@ -374,18 +374,18 @@ void Jit64::DoMergedBranch()
else if ((next.OPCD == 19) && (next.SUBOP10 == 528)) // bcctrx
{
if (next.LK)
MOV(32, M(&LR), Imm32(nextPC + 4));
MOV(32, R(RSCRATCH), M(&CTR));
MOV(32, PPCSTATE(spr[SPR_LR]), Imm32(nextPC + 4));
MOV(32, R(RSCRATCH), PPCSTATE(spr[SPR_CTR]));
AND(32, R(RSCRATCH), Imm32(0xFFFFFFFC));
WriteExitDestInRSCRATCH(next.LK, nextPC + 4);
}
else if ((next.OPCD == 19) && (next.SUBOP10 == 16)) // bclrx
{
MOV(32, R(RSCRATCH), M(&LR));
MOV(32, R(RSCRATCH), PPCSTATE(spr[SPR_LR]));
if (!m_enable_blr_optimization)
AND(32, R(RSCRATCH), Imm32(0xFFFFFFFC));
if (next.LK)
MOV(32, M(&LR), Imm32(nextPC + 4));
MOV(32, PPCSTATE(spr[SPR_LR]), Imm32(nextPC + 4));
WriteBLRExit();
}
else

View File

@ -17,6 +17,7 @@
#include "Core/HW/DSP.h"
#include "Core/HW/Memmap.h"
#include "Core/PowerPC/Jit64/JitRegCache.h"
#include "Core/PowerPC/Jit64Common/Jit64PowerPCState.h"
#include "Core/PowerPC/JitInterface.h"
#include "Core/PowerPC/PowerPC.h"
@ -355,7 +356,7 @@ void Jit64::dcbz(UGeckoInstruction inst)
SwitchToFarCode();
SetJumpTarget(slow);
}
MOV(32, M(&PC), Imm32(js.compilerPC));
MOV(32, PPCSTATE(pc), Imm32(js.compilerPC));
BitSet32 registersInUse = CallerSavedRegistersInUse();
ABI_PushRegistersAndAdjustStack(registersInUse, 0);
ABI_CallFunctionR(PowerPC::ClearCacheLine, RSCRATCH);