Small fix

This commit is contained in:
Nekotekina 2014-08-19 02:33:21 +04:00
parent 293f276f87
commit afe984ca29
3 changed files with 17 additions and 12 deletions

View file

@ -220,13 +220,15 @@ int FPRdouble::Cmp(PPCdouble a, PPCdouble b)
return CR_SO; return CR_SO;
} }
u64 PPUThread::FastCall(u64 addr, u64 arg1, u64 arg2, u64 arg3, u64 arg4, u64 arg5, u64 arg6, u64 arg7, u64 arg8) u64 PPUThread::FastCall(u64 addr, u64 rtoc, u64 arg1, u64 arg2, u64 arg3, u64 arg4, u64 arg5, u64 arg6, u64 arg7, u64 arg8)
{ {
auto old_status = m_status; auto old_status = m_status;
auto old_PC = PC; auto old_PC = PC;
auto old_LR = LR; auto old_LR = LR;
auto old_rtoc = GPR[2];
PC = addr; PC = addr;
GPR[2] = rtoc;
GPR[3] = arg1; GPR[3] = arg1;
GPR[4] = arg2; GPR[4] = arg2;
GPR[5] = arg3; GPR[5] = arg3;
@ -239,6 +241,7 @@ u64 PPUThread::FastCall(u64 addr, u64 arg1, u64 arg2, u64 arg3, u64 arg4, u64 ar
Task(); Task();
GPR[2] = old_rtoc;
LR = old_LR; LR = old_LR;
PC = old_PC; PC = old_PC;
m_status = old_status; m_status = old_status;

View file

@ -842,7 +842,7 @@ public:
public: public:
virtual void InitRegs(); virtual void InitRegs();
virtual u64 GetFreeStackSize() const; virtual u64 GetFreeStackSize() const;
u64 FastCall(u64 addr, u64 arg1 = 0, u64 arg2 = 0, u64 arg3 = 0, u64 arg4 = 0, u64 arg5 = 0, u64 arg6 = 0, u64 arg7 = 0, u64 arg8 = 0); u64 FastCall(u64 addr, u64 rtoc, u64 arg1 = 0, u64 arg2 = 0, u64 arg3 = 0, u64 arg4 = 0, u64 arg5 = 0, u64 arg6 = 0, u64 arg7 = 0, u64 arg8 = 0);
void FastStop(); void FastStop();
protected: protected:

View file

@ -13,7 +13,8 @@ Module *cellSync = nullptr;
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
#include "rpcs3.h" #include "rpcs3.h"
#include "prx_libsre.h" #include "prx_libsre.h"
u32 libsre = 0; u32 libsre;
u32 libsre_rtoc;
#endif #endif
s32 syncMutexInitialize(mem_ptr_t<CellSyncMutex> mutex) s32 syncMutexInitialize(mem_ptr_t<CellSyncMutex> mutex)
@ -1078,7 +1079,7 @@ void syncLFQueueInit(mem_ptr_t<CellSyncLFQueue> queue, u32 buffer_addr, u32 size
s32 syncLFQueueInitialize(mem_ptr_t<CellSyncLFQueue> queue, u32 buffer_addr, u32 size, u32 depth, CellSyncQueueDirection direction, u32 eaSignal_addr) s32 syncLFQueueInitialize(mem_ptr_t<CellSyncLFQueue> queue, u32 buffer_addr, u32 size, u32 depth, CellSyncQueueDirection direction, u32 eaSignal_addr)
{ {
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
return GetCurrentPPUThread().FastCall(libsre + 0x205C, queue.GetAddr(), buffer_addr, size, depth, direction, eaSignal_addr); return GetCurrentPPUThread().FastCall(libsre + 0x205C, libsre_rtoc, queue.GetAddr(), buffer_addr, size, depth, direction, eaSignal_addr);
#else #else
if (!queue) if (!queue)
@ -1522,7 +1523,7 @@ s32 _cellSyncLFQueuePushBody(mem_ptr_t<CellSyncLFQueue> queue, u32 buffer_addr,
if (queue->m_direction.ToBE() != se32(CELL_SYNC_QUEUE_ANY2ANY)) if (queue->m_direction.ToBE() != se32(CELL_SYNC_QUEUE_ANY2ANY))
{ {
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
res = GetCurrentPPUThread().FastCall(libsre + 0x24B0, queue.GetAddr(), position_v.GetAddr(), isBlocking, 0); res = GetCurrentPPUThread().FastCall(libsre + 0x24B0, libsre_rtoc, queue.GetAddr(), position_v.GetAddr(), isBlocking, 0);
position = position_v->ToLE(); position = position_v->ToLE();
#else #else
res = syncLFQueueGetPushPointer(queue, position, isBlocking, 0); res = syncLFQueueGetPushPointer(queue, position, isBlocking, 0);
@ -1531,7 +1532,7 @@ s32 _cellSyncLFQueuePushBody(mem_ptr_t<CellSyncLFQueue> queue, u32 buffer_addr,
else else
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
res = GetCurrentPPUThread().FastCall(libsre + 0x3050, queue.GetAddr(), position_v.GetAddr(), isBlocking, 0); res = GetCurrentPPUThread().FastCall(libsre + 0x3050, libsre_rtoc, queue.GetAddr(), position_v.GetAddr(), isBlocking, 0);
position = position_v->ToLE(); position = position_v->ToLE();
#else #else
res = syncLFQueueGetPushPointer2(queue, position, isBlocking, 0); res = syncLFQueueGetPushPointer2(queue, position, isBlocking, 0);
@ -1566,7 +1567,7 @@ s32 _cellSyncLFQueuePushBody(mem_ptr_t<CellSyncLFQueue> queue, u32 buffer_addr,
if (queue->m_direction.ToBE() != se32(CELL_SYNC_QUEUE_ANY2ANY)) if (queue->m_direction.ToBE() != se32(CELL_SYNC_QUEUE_ANY2ANY))
{ {
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
res = GetCurrentPPUThread().FastCall(libsre + 0x26C0, queue.GetAddr(), position, 0); res = GetCurrentPPUThread().FastCall(libsre + 0x26C0, libsre_rtoc, queue.GetAddr(), position, 0);
#else #else
res = syncLFQueueCompletePushPointer(queue, position, nullptr); res = syncLFQueueCompletePushPointer(queue, position, nullptr);
#endif #endif
@ -1574,7 +1575,7 @@ s32 _cellSyncLFQueuePushBody(mem_ptr_t<CellSyncLFQueue> queue, u32 buffer_addr,
else else
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
res = GetCurrentPPUThread().FastCall(libsre + 0x355C, queue.GetAddr(), position, 0); res = GetCurrentPPUThread().FastCall(libsre + 0x355C, libsre_rtoc, queue.GetAddr(), position, 0);
#else #else
res = syncLFQueueCompletePushPointer2(queue, position, nullptr); res = syncLFQueueCompletePushPointer2(queue, position, nullptr);
#endif #endif
@ -1913,7 +1914,7 @@ s32 _cellSyncLFQueuePopBody(mem_ptr_t<CellSyncLFQueue> queue, u32 buffer_addr, u
if (queue->m_direction.ToBE() != se32(CELL_SYNC_QUEUE_ANY2ANY)) if (queue->m_direction.ToBE() != se32(CELL_SYNC_QUEUE_ANY2ANY))
{ {
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
res = GetCurrentPPUThread().FastCall(libsre + 0x2A90, queue.GetAddr(), position_v.GetAddr(), isBlocking, 0, 0); res = GetCurrentPPUThread().FastCall(libsre + 0x2A90, libsre_rtoc, queue.GetAddr(), position_v.GetAddr(), isBlocking, 0, 0);
position = position_v->ToLE(); position = position_v->ToLE();
#else #else
res = syncLFQueueGetPopPointer(queue, position, isBlocking, 0, 0); res = syncLFQueueGetPopPointer(queue, position, isBlocking, 0, 0);
@ -1922,7 +1923,7 @@ s32 _cellSyncLFQueuePopBody(mem_ptr_t<CellSyncLFQueue> queue, u32 buffer_addr, u
else else
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
res = GetCurrentPPUThread().FastCall(libsre + 0x39AC, queue.GetAddr(), position_v.GetAddr(), isBlocking, 0); res = GetCurrentPPUThread().FastCall(libsre + 0x39AC, libsre_rtoc, queue.GetAddr(), position_v.GetAddr(), isBlocking, 0);
position = position_v->ToLE(); position = position_v->ToLE();
#else #else
res = syncLFQueueGetPopPointer2(queue, position, isBlocking, 0); res = syncLFQueueGetPopPointer2(queue, position, isBlocking, 0);
@ -1954,7 +1955,7 @@ s32 _cellSyncLFQueuePopBody(mem_ptr_t<CellSyncLFQueue> queue, u32 buffer_addr, u
if (queue->m_direction.ToBE() != se32(CELL_SYNC_QUEUE_ANY2ANY)) if (queue->m_direction.ToBE() != se32(CELL_SYNC_QUEUE_ANY2ANY))
{ {
#ifdef PRX_DEBUG_XXX #ifdef PRX_DEBUG_XXX
res = GetCurrentPPUThread().FastCall(libsre + 0x2CA8, queue.GetAddr(), position, 0, 0); res = GetCurrentPPUThread().FastCall(libsre + 0x2CA8, libsre_rtoc, queue.GetAddr(), position, 0, 0);
#else #else
res = syncLFQueueCompletePopPointer(queue, position, nullptr, 0); res = syncLFQueueCompletePopPointer(queue, position, nullptr, 0);
#endif #endif
@ -1962,7 +1963,7 @@ s32 _cellSyncLFQueuePopBody(mem_ptr_t<CellSyncLFQueue> queue, u32 buffer_addr, u
else else
{ {
#ifdef PRX_DEBUG #ifdef PRX_DEBUG
res = GetCurrentPPUThread().FastCall(libsre + 0x3EB8, queue.GetAddr(), position, 0, 0); res = GetCurrentPPUThread().FastCall(libsre + 0x3EB8, libsre_rtoc, queue.GetAddr(), position, 0, 0);
#else #else
res = syncLFQueueCompletePopPointer2(queue, position, nullptr, 0); res = syncLFQueueCompletePopPointer2(queue, position, nullptr, 0);
#endif #endif
@ -2207,6 +2208,7 @@ void cellSync_init()
{ {
libsre = Memory.PRXMem.AllocAlign(sizeof(libsre_data), 4096); libsre = Memory.PRXMem.AllocAlign(sizeof(libsre_data), 4096);
memcpy(Memory + libsre, libsre_data, sizeof(libsre_data)); memcpy(Memory + libsre, libsre_data, sizeof(libsre_data));
libsre_rtoc = libsre + 0x399B0;
}); });
#endif #endif
} }