diff --git a/Common/x64Emitter.h b/Common/x64Emitter.h index 1addb32e38..490b7c7dd7 100644 --- a/Common/x64Emitter.h +++ b/Common/x64Emitter.h @@ -1073,6 +1073,14 @@ public: class XCodeBlock : public CodeBlock { public: void PoisonMemory(int offset) override; + bool RipAccessible(void *ptr) const { +#ifdef _M_IX86 + return true; +#else + ptrdiff_t diff = GetCodePtr() - (const uint8_t *)ptr; + return diff > -0x7FFFFFFF && diff < 0x7FFFFFFF; +#endif + } }; } // namespace diff --git a/Core/MIPS/x86/CompVFPU.cpp b/Core/MIPS/x86/CompVFPU.cpp index 72a8c8c594..b48ddde7e3 100644 --- a/Core/MIPS/x86/CompVFPU.cpp +++ b/Core/MIPS/x86/CompVFPU.cpp @@ -61,7 +61,6 @@ using namespace X64JitConstants; static const float one = 1.0f; static const float minus_one = -1.0f; -static const float zero = 0.0f; const u32 MEMORY_ALIGNED16( noSignMask[4] ) = {0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF}; const u32 MEMORY_ALIGNED16( signBitAll[4] ) = {0x80000000, 0x80000000, 0x80000000, 0x80000000}; @@ -172,7 +171,8 @@ void Jit::ApplyPrefixD(const u8 *vregs, VectorSize sz) { // Zero out XMM0 if it was <= +0.0f (but skip NAN.) MOVSS(R(XMM0), fpr.VX(vregs[i])); - CMPLESS(XMM0, M(&zero)); + XORPS(XMM1, R(XMM1)); + CMPLESS(XMM0, R(XMM1)); ANDNPS(XMM0, fpr.V(vregs[i])); // Retain a NAN in XMM0 (must be second operand.) @@ -3200,21 +3200,22 @@ void Jit::Comp_Vhoriz(MIPSOpcode op) { GetVectorRegsPrefixD(dregs, V_Single, _VD); if (fpr.TryMapDirtyInVS(dregs, V_Single, sregs, sz)) { if (cpu_info.bSSE4_1) { + MOV(PTRBITS, R(TEMPREG), ImmPtr(&oneOneOneOne)); switch (sz) { case V_Pair: MOVAPS(XMM0, fpr.VS(sregs)); - DPPS(XMM0, M(&oneOneOneOne), 0x31); + DPPS(XMM0, MatR(TEMPREG), 0x31); MOVAPS(fpr.VSX(dregs), R(XMM0)); break; case V_Triple: MOVAPS(XMM0, fpr.VS(sregs)); - DPPS(XMM0, M(&oneOneOneOne), 0x71); + DPPS(XMM0, MatR(TEMPREG), 0x71); MOVAPS(fpr.VSX(dregs), R(XMM0)); break; case V_Quad: XORPS(XMM1, R(XMM1)); MOVAPS(XMM0, fpr.VS(sregs)); - DPPS(XMM0, M(&oneOneOneOne), 0xF1); + DPPS(XMM0, MatR(TEMPREG), 0xF1); // In every other case, +0.0 is selected by the mask and added. // But, here we need to manually add it to the result. ADDPS(XMM0, R(XMM1)); @@ -3260,7 +3261,8 @@ void Jit::Comp_Vhoriz(MIPSOpcode op) { } } if (((op >> 16) & 31) == 7) { // vavg - MULSS(fpr.VSX(dregs), M(&vavg_table[n - 1])); + MOV(PTRBITS, R(TEMPREG), ImmPtr(&vavg_table[n - 1])); + MULSS(fpr.VSX(dregs), MatR(TEMPREG)); } ApplyPrefixD(dregs, V_Single); fpr.ReleaseSpillLocks(); @@ -3288,7 +3290,8 @@ void Jit::Comp_Vhoriz(MIPSOpcode op) { case 6: // vfad break; case 7: // vavg - MULSS(reg, M(&vavg_table[n - 1])); + MOV(PTRBITS, R(TEMPREG), ImmPtr(&vavg_table[n - 1])); + MULSS(reg, MatR(TEMPREG)); break; } diff --git a/Core/MIPS/x86/Jit.cpp b/Core/MIPS/x86/Jit.cpp index 738e717590..50f5b95c18 100644 --- a/Core/MIPS/x86/Jit.cpp +++ b/Core/MIPS/x86/Jit.cpp @@ -329,8 +329,7 @@ MIPSOpcode Jit::GetOffsetInstruction(int offset) { return Memory::Read_Instruction(GetCompilerPC() + 4 * offset); } -const u8 *Jit::DoJit(u32 em_address, JitBlock *b) -{ +const u8 *Jit::DoJit(u32 em_address, JitBlock *b) { js.cancel = false; js.blockStart = js.compilerPC = mips_->pc; js.lastContinuedPC = 0; @@ -394,8 +393,7 @@ const u8 *Jit::DoJit(u32 em_address, JitBlock *b) js.numInstructions++; // Safety check, in case we get a bunch of really large jit ops without a lot of branching. - if (GetSpaceLeft() < 0x800 || js.numInstructions >= JitBlockCache::MAX_BLOCK_INSTRUCTIONS) - { + if (GetSpaceLeft() < 0x800 || js.numInstructions >= JitBlockCache::MAX_BLOCK_INSTRUCTIONS) { FlushAll(); WriteExit(GetCompilerPC(), js.nextExit++); js.compiling = false; @@ -405,10 +403,9 @@ const u8 *Jit::DoJit(u32 em_address, JitBlock *b) b->codeSize = (u32)(GetCodePtr() - b->normalEntry); NOP(); AlignCode4(); - if (js.lastContinuedPC == 0) + if (js.lastContinuedPC == 0) { b->originalSize = js.numInstructions; - else - { + } else { // We continued at least once. Add the last proxy and set the originalSize correctly. blocks.ProxyBlock(js.blockStart, js.lastContinuedPC, (GetCompilerPC() - js.lastContinuedPC) / sizeof(u32), GetCodePtr()); b->originalSize = js.initialBlockSize; @@ -416,8 +413,7 @@ const u8 *Jit::DoJit(u32 em_address, JitBlock *b) return b->normalEntry; } -void Jit::AddContinuedBlock(u32 dest) -{ +void Jit::AddContinuedBlock(u32 dest) { // The first block is the root block. When we continue, we create proxy blocks after that. if (js.lastContinuedPC == 0) js.initialBlockSize = js.numInstructions; @@ -703,8 +699,7 @@ void Jit::WriteExit(u32 destination, int exit_num) { void Jit::WriteExitDestInReg(X64Reg reg) { // If we need to verify coreState and rewind, we may not jump yet. - if (js.afterOp & (JitState::AFTER_CORE_STATE | JitState::AFTER_REWIND_PC_BAD_STATE)) - { + if (js.afterOp & (JitState::AFTER_CORE_STATE | JitState::AFTER_REWIND_PC_BAD_STATE)) { // CORE_RUNNING is <= CORE_NEXTFRAME. CMP(32, M(&coreState), Imm32(CORE_NEXTFRAME)); FixupBranch skipCheck = J_CC(CC_LE); diff --git a/Core/System.h b/Core/System.h index 3746c01679..338d679fe1 100644 --- a/Core/System.h +++ b/Core/System.h @@ -72,8 +72,6 @@ void PSP_BeginHostFrame(); void PSP_EndHostFrame(); void PSP_RunLoopUntil(u64 globalticks); void PSP_RunLoopFor(int cycles); -void PSP_BeginFrame(); -void PSP_EndFrame(); void Audio_Init(); @@ -88,8 +86,7 @@ void InitSysDirectories(); #endif // RUNNING must be at 0, NEXTFRAME must be at 1. -enum CoreState -{ +enum CoreState { CORE_RUNNING = 0, CORE_NEXTFRAME = 1, CORE_STEPPING,