32-bit build fix, proper fix for lfd. THP glitches are gone! (at least in the games I tried)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@997 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2008-10-28 23:04:28 +00:00
parent 9e14b2575d
commit 9e23e6aec4
3 changed files with 15 additions and 7 deletions

View File

@ -85,7 +85,11 @@ LONG NTAPI Handler(PEXCEPTION_POINTERS pPtrs)
// We no longer touch Rip, since we return back to the instruction, after overwriting it with a
// trampoline jump and some nops
if (new_rip)
#ifdef _M_X64
ctx->Rip = (DWORD_PTR)new_rip;
#else
ctx->Eip = (DWORD_PTR)new_rip;
#endif
}
return (DWORD)EXCEPTION_CONTINUE_EXECUTION;

View File

@ -189,6 +189,8 @@ u8 *BackPatch(u8 *codePtr, int accessType, u32 emAddress, CONTEXT *ctx)
return codePtr - 2;
}
return 0;
#else
return 0;
#endif
}

View File

@ -104,8 +104,6 @@ void lfs(UGeckoInstruction inst)
void lfd(UGeckoInstruction inst)
{
Default(inst);
return;
#ifdef JIT_OFF_OPTIONS
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreFloatingOff)
{Default(inst); return;} // turn off from debugger
@ -125,26 +123,30 @@ void lfd(UGeckoInstruction inst)
gpr.FlushLockX(ABI_PARAM1);
gpr.Lock(a);
MOV(32, R(ABI_PARAM1), gpr.R(a));
fpr.LoadToX64(d, false);
// TODO - optimize. This has to load the previous value - upper double should stay unmodified.
fpr.LoadToX64(d, true);
fpr.Lock(d);
if (cpu_info.bSSSE3) {
X64Reg xd = fpr.RX(d);
#ifdef _M_X64
MOVQ_xmm(xd, MComplex(RBX, ABI_PARAM1, SCALE_1, offset));
MOVQ_xmm(XMM0, MComplex(RBX, ABI_PARAM1, SCALE_1, offset));
#else
MOV(32, R(EAX), R(ABI_PARAM1));
AND(32, R(EAX), Imm32(Memory::MEMVIEW32_MASK));
MOVQ_xmm(xd, MDisp(EAX, (u32)Memory::base + offset));
MOVQ_xmm(XMM0, MDisp(EAX, (u32)Memory::base + offset));
#endif
PSHUFB(xd, M((void *)bswapShuffle1x8Dupe));
PSHUFB(XMM0, M((void *)bswapShuffle1x8Dupe));
MOVSD(xd, R(XMM0));
} else {
#ifndef _M_X64
PanicAlert("lfd - wtf");
#endif
X64Reg xd = fpr.RX(d);
MOV(64, R(EAX), MComplex(RBX, ABI_PARAM1, SCALE_1, offset));
BSWAP(64, EAX);
MOV(64, M(&temp64), R(EAX));
MOVDDUP(fpr.RX(d), M(&temp64));
MOVSD(XMM0, M(&temp64));
MOVSD(xd, R(XMM0));
}
gpr.UnlockAll();
gpr.UnlockAllX();