From 017bfcda2be6683af57bedc972e6da2d37534784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Thu, 21 Sep 2017 22:09:54 +0200 Subject: [PATCH] DSP: Fix gdsp_ifx_write to take a u16 value And change the JIT to clear the upper 16 bits when calling the write function to work around bugs in some compilers like clang. --- Source/Core/Core/DSP/DSPHWInterface.cpp | 2 +- Source/Core/Core/DSP/DSPHWInterface.h | 2 +- Source/Core/Core/DSP/Jit/DSPJitUtil.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Core/Core/DSP/DSPHWInterface.cpp b/Source/Core/Core/DSP/DSPHWInterface.cpp index c965233a8e..0e773b8b4b 100644 --- a/Source/Core/Core/DSP/DSPHWInterface.cpp +++ b/Source/Core/Core/DSP/DSPHWInterface.cpp @@ -98,7 +98,7 @@ u16 gdsp_mbox_read_l(Mailbox mbx) return (u16)value; } -void gdsp_ifx_write(u32 addr, u32 val) +void gdsp_ifx_write(u32 addr, u16 val) { g_dsp_cap->LogIFXWrite(addr, val); diff --git a/Source/Core/Core/DSP/DSPHWInterface.h b/Source/Core/Core/DSP/DSPHWInterface.h index 329851fb9a..8c68e1c834 100644 --- a/Source/Core/Core/DSP/DSPHWInterface.h +++ b/Source/Core/Core/DSP/DSPHWInterface.h @@ -22,6 +22,6 @@ u16 gdsp_mbox_read_h(Mailbox mbx); u16 gdsp_mbox_read_l(Mailbox mbx); void gdsp_ifx_init(); -void gdsp_ifx_write(u32 addr, u32 val); +void gdsp_ifx_write(u32 addr, u16 val); u16 gdsp_ifx_read(u16 addr); } // namespace DSP diff --git a/Source/Core/Core/DSP/Jit/DSPJitUtil.cpp b/Source/Core/Core/DSP/Jit/DSPJitUtil.cpp index 842362c1fb..476637badb 100644 --- a/Source/Core/Core/DSP/Jit/DSPJitUtil.cpp +++ b/Source/Core/Core/DSP/Jit/DSPJitUtil.cpp @@ -530,9 +530,9 @@ void DSPEmitter::dmem_write(X64Reg value) FixupBranch end = J(true); // else if (saddr == 0xf) SetJumpTarget(ifx); - // Does it mean gdsp_ifx_write needs u32 rather than u16? DSPJitRegCache c(m_gpr); X64Reg abisafereg = m_gpr.MakeABICallSafe(value); + MOVZX(32, 16, abisafereg, R(abisafereg)); m_gpr.PushRegs(); ABI_CallFunctionRR(gdsp_ifx_write, EAX, abisafereg); m_gpr.PopRegs();