- fix truncated load addresses due to a bug in asmjit

- change ToMemAddress to use uint64_t
This commit is contained in:
Magnus Norddahl 2018-09-15 15:38:16 +02:00
parent 06b54d3aaa
commit 4364feea9a
2 changed files with 14 additions and 10 deletions

View file

@ -16,9 +16,9 @@ void JitCompiler::EmitLK()
void JitCompiler::EmitLKF() void JitCompiler::EmitLKF()
{ {
auto tmp = cc.newIntPtr(); auto base = cc.newIntPtr();
cc.mov(tmp, ToMemAddress(konstf + BC)); cc.mov(base, ToMemAddress(konstf + BC));
cc.movsd(regF[A], asmjit::x86::qword_ptr(tmp)); cc.movsd(regF[A], asmjit::x86::qword_ptr(base));
} }
void JitCompiler::EmitLKS() void JitCompiler::EmitLKS()
@ -36,14 +36,16 @@ void JitCompiler::EmitLKP()
void JitCompiler::EmitLK_R() void JitCompiler::EmitLK_R()
{ {
cc.mov(regD[A], asmjit::x86::ptr(ToMemAddress(konstd + C), regD[B], 2)); auto base = cc.newIntPtr();
cc.mov(base, ToMemAddress(konstd + C));
cc.mov(regD[A], asmjit::x86::ptr(base, regD[B], 2));
} }
void JitCompiler::EmitLKF_R() void JitCompiler::EmitLKF_R()
{ {
auto tmp = cc.newIntPtr(); auto base = cc.newIntPtr();
cc.mov(tmp, ToMemAddress(konstf + C)); cc.mov(base, ToMemAddress(konstf + C));
cc.movsd(regF[A], asmjit::x86::qword_ptr(tmp, regD[B], 3)); cc.movsd(regF[A], asmjit::x86::qword_ptr(base, regD[B], 3));
} }
void JitCompiler::EmitLKS_R() void JitCompiler::EmitLKS_R()
@ -68,7 +70,9 @@ void JitCompiler::EmitLKS_R()
void JitCompiler::EmitLKP_R() void JitCompiler::EmitLKP_R()
{ {
cc.mov(regA[A], asmjit::x86::ptr(ToMemAddress(konsta + C), regD[B], 2)); auto base = cc.newIntPtr();
cc.mov(base, ToMemAddress(konsta + C));
cc.mov(regA[A], asmjit::x86::ptr(base, regD[B], 2));
} }
void JitCompiler::EmitLFP() void JitCompiler::EmitLFP()

View file

@ -65,9 +65,9 @@ private:
pc++; // This instruction uses two instruction slots - skip the next one pc++; // This instruction uses two instruction slots - skip the next one
} }
static int64_t ToMemAddress(const void *d) static uint64_t ToMemAddress(const void *d)
{ {
return (int64_t)(ptrdiff_t)d; return (uint64_t)(ptrdiff_t)d;
} }
void CallSqrt(const asmjit::X86Xmm &a, const asmjit::X86Xmm &b); void CallSqrt(const asmjit::X86Xmm &a, const asmjit::X86Xmm &b);