From 73c2628ef40d52845081fdb0c2ea20b6db474cbf Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Mon, 2 Dec 2013 22:49:06 +0400 Subject: [PATCH] SPU Fixes 3.2 --- rpcs3/Emu/Cell/SPUInterpreter.h | 12 +++---- rpcs3/Emu/Cell/SPUThread.h | 63 +++++++++++++++++++++++++++++++-- rpcs3/rpcs3.vcxproj | 3 +- rpcs3/rpcs3.vcxproj.filters | 5 ++- 4 files changed, 73 insertions(+), 10 deletions(-) diff --git a/rpcs3/Emu/Cell/SPUInterpreter.h b/rpcs3/Emu/Cell/SPUInterpreter.h index ad2721572c..160febdbca 100644 --- a/rpcs3/Emu/Cell/SPUInterpreter.h +++ b/rpcs3/Emu/Cell/SPUInterpreter.h @@ -390,8 +390,8 @@ private: //(SSE) RSQRTPS - Compute Reciprocals of Square Roots of Packed Single-Precision Floating-Point Values //rt = approximate(1/sqrt(abs(ra))) //abs(ra) === ra & FloatAbsMask - const __m128 FloatAbsMask = {0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff}; - CPU.GPR[rt]._m128 = _mm_rsqrt_ps(_mm_and_ps(CPU.GPR[ra]._m128, FloatAbsMask)); + const __m128i FloatAbsMask = {0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff}; + CPU.GPR[rt]._m128 = _mm_rsqrt_ps(_mm_and_ps(CPU.GPR[ra]._m128, (__m128&)FloatAbsMask)); } void LQX(u32 rt, u32 ra, u32 rb) { @@ -869,14 +869,14 @@ private: for (int i = 0; i < 2; i++) { if (temp._u64[i] & DoubleFracMask) - if (temp._u64[i] & DoubleSignMask & DoubleExpMask == DoubleSignMask) + if ((temp._u64[i] & (DoubleSignMask & DoubleExpMask)) == DoubleSignMask) CPU.GPR[rt]._u64[i] = 0xffffffffffffffff; } if (i7 & 2) //Positive Denorm Check (+, exp is zero, frac is non-zero) for (int i = 0; i < 2; i++) { if (temp._u64[i] & DoubleFracMask) - if (temp._u64[i] & DoubleSignMask & DoubleExpMask == 0) + if ((temp._u64[i] & (DoubleSignMask & DoubleExpMask)) == 0) CPU.GPR[rt]._u64[i] = 0xffffffffffffffff; } if (i7 & 4) //Negative Zero Check (-, exp is zero, frac is zero) @@ -894,7 +894,7 @@ private: if (i7 & 16) //Negative Infinity Check (-, exp is 0x7ff, frac is zero) for (int i = 0; i < 2; i++) { - if (temp._u64[i] == DoubleSignMask & DoubleExpMask) + if (temp._u64[i] == (DoubleSignMask & DoubleExpMask)) CPU.GPR[rt]._u64[i] = 0xffffffffffffffff; } if (i7 & 32) //Positive Infinity Check (+, exp is 0x7ff, frac is zero) @@ -907,7 +907,7 @@ private: for (int i = 0; i < 2; i++) { if (temp._u64[i] & DoubleFracMask) - if (temp._u64[i] & DoubleExpMask == DoubleExpMask) + if ((temp._u64[i] & DoubleExpMask) == DoubleExpMask) CPU.GPR[rt]._u64[i] = 0xffffffffffffffff; } } diff --git a/rpcs3/Emu/Cell/SPUThread.h b/rpcs3/Emu/Cell/SPUThread.h index ade6b92574..9db744895b 100644 --- a/rpcs3/Emu/Cell/SPUThread.h +++ b/rpcs3/Emu/Cell/SPUThread.h @@ -233,13 +233,13 @@ union SPU_SPR_hdr { u128 _u128; s128 _i128; - + u32 _u32[4]; SPU_SPR_hdr() {} wxString ToString() const { - return wxString::Format("%16%16", _u128.hi, _u128.lo); + return wxString::Format("%08x%08x%08x%08x", _u32[3], _u32[2], _u32[1], _u32[0]); } void Reset() @@ -356,6 +356,34 @@ public: { switch(ch) { + case SPU_RdEventStat: //Read event status with mask applied + case SPU_WrEventMask: //Write event mask + case SPU_WrEventAck: //Write end of event processing + case SPU_RdSigNotify1: //Signal notification 1 + case SPU_RdSigNotify2: //Signal notification 2 + case SPU_WrDec: //Write decrementer count + case SPU_RdDec: //Read decrementer count + case SPU_RdEventMask: //Read event mask + case SPU_RdMachStat: //Read SPU run status + case SPU_WrSRR0: //Write SPU machine state save/restore register 0 (SRR0) + case SPU_RdSRR0: //Read SPU machine state save/restore register 0 (SRR0) + case MFC_WrMSSyncReq: //Write multisource synchronization request + case MFC_RdTagMask: //Read tag mask + case MFC_LSA: //Write local memory address command parameter + case MFC_EAH: //Write high order DMA effective address command parameter + case MFC_EAL: //Write low order DMA effective address command parameter + case MFC_Size: //Write DMA transfer size command parameter + case MFC_TagID: //Write tag identifier command parameter + case MFC_Cmd: //Write and enqueue DMA command with associated class ID + case MFC_WrTagMask: //Write tag mask + case MFC_WrTagUpdate: //Write request for conditional or unconditional tag status update + case MFC_RdTagStat: //Read tag status with mask applied + case MFC_RdListStallStat: //Read DMA list stall-and-notify status + case MFC_WrListStallAck: //Write DMA list stall-and-notify acknowledge + case MFC_RdAtomicStat: //Read completion status of last completed immediate MFC atomic update command + ConLog.Error("%s error: unimplemented channel (%s).", __FUNCTION__, spu_ch_name[ch]); + break; + case SPU_WrOutMbox: return SPU.Out_MBox.GetFreeCount(); @@ -379,6 +407,23 @@ public: switch(ch) { + case SPU_WrEventMask: //Write event mask + case SPU_WrEventAck: //Write end of event processing + case SPU_WrDec: //Write decrementer count + case SPU_WrSRR0: //Write SPU machine state save/restore register 0 (SRR0) + case MFC_WrMSSyncReq: //Write multisource synchronization request + case MFC_LSA: //Write local memory address command parameter + case MFC_EAH: //Write high order DMA effective address command parameter + case MFC_EAL: //Write low order DMA effective address command parameter + case MFC_Size: //Write DMA transfer size command parameter + case MFC_TagID: //Write tag identifier command parameter + case MFC_Cmd: //Write and enqueue DMA command with associated class ID + case MFC_WrTagMask: //Write tag mask + case MFC_WrTagUpdate: //Write request for conditional or unconditional tag status update + case MFC_WrListStallAck: //Write DMA list stall-and-notify acknowledge + ConLog.Error("%s error: unimplemented channel (%s).", __FUNCTION__, spu_ch_name[ch]); + break; + case SPU_WrOutIntrMbox: ConLog.Warning("SPU_WrOutIntrMbox = 0x%x", v); @@ -410,6 +455,20 @@ public: switch(ch) { + case SPU_RdEventStat: //Read event status with mask applied + case SPU_RdSigNotify1: //Signal notification 1 + case SPU_RdSigNotify2: //Signal notification 2 + case SPU_RdDec: //Read decrementer count + case SPU_RdEventMask: //Read event mask + case SPU_RdMachStat: //Read SPU run status + case SPU_RdSRR0: //Read SPU machine state save/restore register 0 (SRR0) + case MFC_RdTagMask: //Read tag mask + case MFC_RdTagStat: //Read tag status with mask applied + case MFC_RdListStallStat: //Read DMA list stall-and-notify status + case MFC_RdAtomicStat: //Read completion status of last completed immediate MFC atomic update command + ConLog.Error("%s error: unimplemented channel (%s).", __FUNCTION__, spu_ch_name[ch]); + break; + case SPU_RdInMbox: if(!SPU.In_MBox.Pop(v)) v = 0; ConLog.Warning("%s: SPU_RdInMbox(0x%x).", __FUNCTION__, v); diff --git a/rpcs3/rpcs3.vcxproj b/rpcs3/rpcs3.vcxproj index 62a417b4d9..ae92a31c8d 100644 --- a/rpcs3/rpcs3.vcxproj +++ b/rpcs3/rpcs3.vcxproj @@ -1,4 +1,4 @@ - + @@ -322,6 +322,7 @@ + diff --git a/rpcs3/rpcs3.vcxproj.filters b/rpcs3/rpcs3.vcxproj.filters index 7ac21c6caa..e01793878c 100644 --- a/rpcs3/rpcs3.vcxproj.filters +++ b/rpcs3/rpcs3.vcxproj.filters @@ -1,4 +1,4 @@ - + @@ -510,5 +510,8 @@ Utilities + + Include + \ No newline at end of file