diff options
| author | MerryMage <MerryMage@users.noreply.github.com> | 2017-04-12 07:54:32 +0100 |
|---|---|---|
| committer | MerryMage <MerryMage@users.noreply.github.com> | 2017-04-12 19:30:42 +0100 |
| commit | 265f0da25663d362ee844d0957f90da513bbf718 (patch) | |
| tree | b105f57d9923c80126a1a56710a6027904e9a258 /Source | |
| parent | a95010bc72c0a5ad0c6b0604a18c929e5dc779b1 (diff) | |
Jit_LoadStorePaired: Make psq_st PIE-compliant
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp | 12 | ||||
| -rw-r--r-- | Source/Core/Core/PowerPC/Jit64Common/Jit64AsmCommon.cpp | 6 |
2 files changed, 10 insertions, 8 deletions
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp index b260de56dc..26cb06c37e 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp @@ -89,12 +89,12 @@ void Jit64::psq_stXX(UGeckoInstruction inst) // 0b0011111100000111, or 0x3F07. MOV(32, R(RSCRATCH2), Imm32(0x3F07)); AND(32, R(RSCRATCH2), PPCSTATE(spr[SPR_GQR0 + i])); - MOVZX(32, 8, RSCRATCH, R(RSCRATCH2)); - - if (w) - CALLptr(MScaled(RSCRATCH, SCALE_8, PtrOffset(asm_routines.singleStoreQuantized))); - else - CALLptr(MScaled(RSCRATCH, SCALE_8, PtrOffset(asm_routines.pairedStoreQuantized))); + LEA(64, RSCRATCH, M(w ? asm_routines.singleStoreQuantized : asm_routines.pairedStoreQuantized)); + // 8-bit operations do not zero upper 32-bits of 64-bit registers. + // Here we know that RSCRATCH's least significant byte is zero. + OR(8, R(RSCRATCH), R(RSCRATCH2)); + SHL(8, R(RSCRATCH), Imm8(3)); + CALLptr(MatR(RSCRATCH)); } if (update && jo.memcheck) diff --git a/Source/Core/Core/PowerPC/Jit64Common/Jit64AsmCommon.cpp b/Source/Core/Core/PowerPC/Jit64Common/Jit64AsmCommon.cpp index dce31b4d4b..9180be67f4 100644 --- a/Source/Core/Core/PowerPC/Jit64Common/Jit64AsmCommon.cpp +++ b/Source/Core/Core/PowerPC/Jit64Common/Jit64AsmCommon.cpp @@ -243,7 +243,8 @@ constexpr std::array<u8, 8> sizes{{32, 0, 0, 0, 8, 16, 8, 16}}; void CommonAsmRoutines::GenQuantizedStores() { - pairedStoreQuantized = reinterpret_cast<const u8**>(const_cast<u8*>(AlignCode16())); + // Aligned to 256 bytes as least significant byte needs to be zero (See: Jit64::psq_stXX). + pairedStoreQuantized = reinterpret_cast<const u8**>(const_cast<u8*>(AlignCodeTo(256))); ReserveCodeSpace(8 * sizeof(u8*)); for (int type = 0; type < 8; type++) @@ -253,7 +254,8 @@ void CommonAsmRoutines::GenQuantizedStores() // See comment in header for in/outs. void CommonAsmRoutines::GenQuantizedSingleStores() { - singleStoreQuantized = reinterpret_cast<const u8**>(const_cast<u8*>(AlignCode16())); + // Aligned to 256 bytes as least significant byte needs to be zero (See: Jit64::psq_stXX). + singleStoreQuantized = reinterpret_cast<const u8**>(const_cast<u8*>(AlignCodeTo(256))); ReserveCodeSpace(8 * sizeof(u8*)); for (int type = 0; type < 8; type++) |
