mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 19:45:20 +00:00
vm::var fix, vm::ptr improved
GetCurrentPPUThread() removed
This commit is contained in:
parent
46e4f2d48c
commit
714da1aa7c
18 changed files with 102 additions and 131 deletions
|
@ -10,11 +10,6 @@
|
|||
#include "CPUDecoder.h"
|
||||
#include "CPUThread.h"
|
||||
|
||||
CPUThread* GetCurrentCPUThread()
|
||||
{
|
||||
return dynamic_cast<CPUThread*>(GetCurrentNamedThread());
|
||||
}
|
||||
|
||||
CPUThread::CPUThread(CPUThreadType type)
|
||||
: ThreadBase("CPUThread")
|
||||
, m_events(0)
|
||||
|
|
|
@ -229,8 +229,6 @@ protected:
|
|||
virtual void Task();
|
||||
};
|
||||
|
||||
CPUThread* GetCurrentCPUThread();
|
||||
|
||||
class cpu_thread
|
||||
{
|
||||
protected:
|
||||
|
|
|
@ -489,15 +489,6 @@ void fill_ppu_exec_map(u32 addr, u32 size)
|
|||
}
|
||||
}
|
||||
|
||||
PPUThread& GetCurrentPPUThread()
|
||||
{
|
||||
CPUThread* thread = GetCurrentCPUThread();
|
||||
|
||||
if(!thread || thread->GetType() != CPU_THREAD_PPU) throw std::string("GetCurrentPPUThread: bad thread");
|
||||
|
||||
return *(PPUThread*)thread;
|
||||
}
|
||||
|
||||
PPUThread::PPUThread() : CPUThread(CPU_THREAD_PPU)
|
||||
{
|
||||
Reset();
|
||||
|
|
|
@ -823,8 +823,6 @@ protected:
|
|||
virtual void DoStop() override;
|
||||
};
|
||||
|
||||
PPUThread& GetCurrentPPUThread();
|
||||
|
||||
class ppu_thread : cpu_thread
|
||||
{
|
||||
static const u32 stack_align = 0x10;
|
||||
|
|
|
@ -28,5 +28,3 @@ public:
|
|||
private:
|
||||
virtual void Task();
|
||||
};
|
||||
|
||||
SPUThread& GetCurrentSPUThread();
|
||||
|
|
|
@ -57,18 +57,6 @@ public:
|
|||
}
|
||||
g_spu_inter_func_list;
|
||||
|
||||
SPUThread& GetCurrentSPUThread()
|
||||
{
|
||||
CPUThread* thread = GetCurrentCPUThread();
|
||||
|
||||
if(!thread || (thread->GetType() != CPU_THREAD_SPU && thread->GetType() != CPU_THREAD_RAW_SPU))
|
||||
{
|
||||
throw std::string("GetCurrentSPUThread: bad thread");
|
||||
}
|
||||
|
||||
return *(SPUThread*)thread;
|
||||
}
|
||||
|
||||
SPUThread::SPUThread(CPUThreadType type) : CPUThread(type)
|
||||
{
|
||||
assert(type == CPU_THREAD_SPU || type == CPU_THREAD_RAW_SPU);
|
||||
|
|
|
@ -698,8 +698,6 @@ protected:
|
|||
virtual void DoClose();
|
||||
};
|
||||
|
||||
SPUThread& GetCurrentSPUThread();
|
||||
|
||||
class spu_thread : cpu_thread
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -5,10 +5,23 @@ struct ARMv7Context;
|
|||
|
||||
namespace vm
|
||||
{
|
||||
// helper SFINAE type for vm::_ptr_base comparison operators (enables comparison between equal types and between any type and void*)
|
||||
template<typename T1, typename T2, typename RT = void> using if_comparable_t = std::enable_if_t<
|
||||
std::is_void<T1>::value ||
|
||||
std::is_void<T2>::value ||
|
||||
std::is_same<std::remove_cv_t<T1>, std::remove_cv_t<T2>>::value,
|
||||
RT>;
|
||||
|
||||
// helper SFINAE type for vm::_ptr_base pointer arithmetic operators and indirection (disabled for void and function pointers)
|
||||
template<typename T, typename RT = void> using if_arithmetical_ptr_t = std::enable_if_t<
|
||||
!std::is_void<T>::value &&
|
||||
!std::is_function<T>::value,
|
||||
RT>;
|
||||
|
||||
template<typename T, typename AT = u32>
|
||||
struct _ptr_base
|
||||
{
|
||||
AT m_addr;
|
||||
AT m_addr; // don't access directly
|
||||
|
||||
using type = T;
|
||||
|
||||
|
@ -19,13 +32,27 @@ namespace vm
|
|||
{
|
||||
return m_addr;
|
||||
}
|
||||
|
||||
// get vm pointer to member
|
||||
template<typename MT, typename T2, typename = if_comparable_t<T, T2>> _ptr_base<MT> of(MT T2::*const member) const
|
||||
{
|
||||
const u32 offset = static_cast<u32>(reinterpret_cast<std::ptrdiff_t>(&(reinterpret_cast<T*>(0ull)->*member)));
|
||||
return{ vm::cast(m_addr + offset) };
|
||||
}
|
||||
|
||||
// get vm pointer to array member with array subscribtion
|
||||
template<typename MT, typename T2, typename = if_comparable_t<T, T2>> _ptr_base<std::remove_extent_t<MT>> of(MT T2::*const member, u32 index) const
|
||||
{
|
||||
const u32 offset = static_cast<u32>(reinterpret_cast<std::ptrdiff_t>(&(reinterpret_cast<T*>(0ull)->*member)));
|
||||
return{ vm::cast(m_addr + offset + sizeof32(T) * index) };
|
||||
}
|
||||
|
||||
template<typename CT> std::enable_if_t<std::is_assignable<AT&, CT>::value> set(const CT& value)
|
||||
{
|
||||
m_addr = value;
|
||||
}
|
||||
|
||||
template<typename AT2 = AT> static _ptr_base make(const AT2& addr)
|
||||
template<typename AT2 = AT> static std::enable_if_t<std::is_assignable<AT&, AT2>::value, _ptr_base> make(const AT2& addr)
|
||||
{
|
||||
return{ convert_le_be<AT>(addr) };
|
||||
}
|
||||
|
@ -105,15 +132,12 @@ namespace vm
|
|||
return{ convert_le_be<AT>(addr) };
|
||||
}
|
||||
|
||||
// defined in CB_FUNC.h, call using specified PPU thread context
|
||||
// defined in CB_FUNC.h, passing context is mandatory
|
||||
RT operator()(PPUThread& CPU, T... args) const;
|
||||
|
||||
// defined in ARMv7Callback.h, passing context is mandatory
|
||||
RT operator()(ARMv7Context& context, T... args) const;
|
||||
|
||||
// defined in CB_FUNC.h, call using current PPU thread context
|
||||
RT operator()(T... args) const;
|
||||
|
||||
// conversion to another function pointer
|
||||
template<typename AT2> operator _ptr_base<type, AT2>() const
|
||||
{
|
||||
|
@ -213,19 +237,6 @@ namespace vm
|
|||
// vm::null is convertible to any vm::ptr type as null pointer in virtual memory
|
||||
static null_t null;
|
||||
|
||||
// helper SFINAE type for vm::_ptr_base comparison operators (enables comparison between equal types and between any type and void*)
|
||||
template<typename T1, typename T2, typename RT> using if_comparable_t = std::enable_if_t<
|
||||
std::is_void<T1>::value ||
|
||||
std::is_void<T2>::value ||
|
||||
std::is_same<std::remove_cv_t<T1>, std::remove_cv_t<T2>>::value,
|
||||
RT>;
|
||||
|
||||
// helper SFINAE type for vm::_ptr_base pointer arithmetic operators and indirection (disabled for void and function pointers)
|
||||
template<typename T, typename RT> using if_arithmetical_ptr_t = std::enable_if_t<
|
||||
!std::is_void<T>::value &&
|
||||
!std::is_function<T>::value,
|
||||
RT>;
|
||||
|
||||
// perform static_cast (for example, vm::ptr<void> to vm::ptr<char>)
|
||||
template<typename CT, typename T, typename AT, typename = decltype(static_cast<CT*>(std::declval<T*>()))> inline _ptr_base<CT, AT> static_ptr_cast(const _ptr_base<T, AT>& other)
|
||||
{
|
||||
|
|
|
@ -539,7 +539,7 @@ namespace vm
|
|||
CPUThread& m_thread;
|
||||
|
||||
public:
|
||||
stackvar(CPUThread& CPU, u32 size = sizeof(T), u32 align = __alignof(T))
|
||||
stackvar(CPUThread& CPU, u32 size = sizeof32(T), u32 align = alignof32(T))
|
||||
: m_data(CPU, size, align)
|
||||
, m_thread(CPU)
|
||||
{
|
||||
|
@ -597,6 +597,16 @@ namespace vm
|
|||
return *m_data.ptr;
|
||||
}
|
||||
|
||||
T& operator [](u32 index)
|
||||
{
|
||||
return m_data.ptr[index];
|
||||
}
|
||||
|
||||
const T& operator [](u32 index) const
|
||||
{
|
||||
return m_data.ptr[index];
|
||||
}
|
||||
|
||||
u32 addr() const
|
||||
{
|
||||
return m_data.addr;
|
||||
|
|
|
@ -170,12 +170,6 @@ namespace vm
|
|||
|
||||
return cb_detail::_func_caller<RT, T...>::call(CPU, pc, rtoc, args...);
|
||||
}
|
||||
|
||||
template<typename AT, typename RT, typename... T>
|
||||
force_inline RT _ptr_base<RT(T...), AT>::operator()(T... args) const
|
||||
{
|
||||
return operator()(GetCurrentPPUThread(), args...);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename RT, typename... T>
|
||||
|
|
|
@ -341,7 +341,7 @@ s32 cellGameDataCheckCreate2(PPUThread& CPU, u32 version, vm::cptr<char> dirName
|
|||
strcpy_trunc(cbGet->getParam.title, psf.GetString("TITLE"));
|
||||
// TODO: write lang titles
|
||||
|
||||
funcStat(cbResult, cbGet, cbSet);
|
||||
funcStat(CPU, cbResult, cbGet, cbSet);
|
||||
|
||||
if (cbSet->setParam)
|
||||
{
|
||||
|
|
|
@ -480,7 +480,7 @@ void cellGcmSetFlipStatus()
|
|||
Emu.GetGSManager().GetRender().m_flip_status = 0;
|
||||
}
|
||||
|
||||
s32 cellGcmSetPrepareFlip(vm::ptr<CellGcmContextData> ctxt, u32 id)
|
||||
s32 cellGcmSetPrepareFlip(PPUThread& CPU, vm::ptr<CellGcmContextData> ctxt, u32 id)
|
||||
{
|
||||
cellGcmSys.Log("cellGcmSetPrepareFlip(ctx=0x%x, id=0x%x)", ctxt.addr(), id);
|
||||
|
||||
|
@ -503,7 +503,7 @@ s32 cellGcmSetPrepareFlip(vm::ptr<CellGcmContextData> ctxt, u32 id)
|
|||
if (current + 8 >= ctxt->end)
|
||||
{
|
||||
cellGcmSys.Error("Bad flip!");
|
||||
if (s32 res = ctxt->callback(ctxt, 8 /* ??? */))
|
||||
if (s32 res = ctxt->callback(CPU, ctxt, 8 /* ??? */))
|
||||
{
|
||||
cellGcmSys.Error("cellGcmSetPrepareFlip : callback failed (0x%08x)", res);
|
||||
return res;
|
||||
|
@ -527,11 +527,11 @@ s32 cellGcmSetPrepareFlip(vm::ptr<CellGcmContextData> ctxt, u32 id)
|
|||
return id;
|
||||
}
|
||||
|
||||
s32 cellGcmSetFlip(vm::ptr<CellGcmContextData> ctxt, u32 id)
|
||||
s32 cellGcmSetFlip(PPUThread& CPU, vm::ptr<CellGcmContextData> ctxt, u32 id)
|
||||
{
|
||||
cellGcmSys.Log("cellGcmSetFlip(ctx=0x%x, id=0x%x)", ctxt.addr(), id);
|
||||
|
||||
s32 res = cellGcmSetPrepareFlip(ctxt, id);
|
||||
s32 res = cellGcmSetPrepareFlip(CPU, ctxt, id);
|
||||
return res < 0 ? CELL_GCM_ERROR_FAILURE : CELL_OK;
|
||||
}
|
||||
|
||||
|
@ -1096,19 +1096,19 @@ void cellGcmSetDefaultCommandBuffer()
|
|||
// Other
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
s32 _cellGcmSetFlipCommand(vm::ptr<CellGcmContextData> ctx, u32 id)
|
||||
s32 _cellGcmSetFlipCommand(PPUThread& CPU, vm::ptr<CellGcmContextData> ctx, u32 id)
|
||||
{
|
||||
cellGcmSys.Log("cellGcmSetFlipCommand(ctx_addr=0x%x, id=0x%x)", ctx.addr(), id);
|
||||
|
||||
return cellGcmSetPrepareFlip(ctx, id);
|
||||
return cellGcmSetPrepareFlip(CPU, ctx, id);
|
||||
}
|
||||
|
||||
s32 _cellGcmSetFlipCommandWithWaitLabel(vm::ptr<CellGcmContextData> ctx, u32 id, u32 label_index, u32 label_value)
|
||||
s32 _cellGcmSetFlipCommandWithWaitLabel(PPUThread& CPU, vm::ptr<CellGcmContextData> ctx, u32 id, u32 label_index, u32 label_value)
|
||||
{
|
||||
cellGcmSys.Log("cellGcmSetFlipCommandWithWaitLabel(ctx_addr=0x%x, id=0x%x, label_index=0x%x, label_value=0x%x)",
|
||||
ctx.addr(), id, label_index, label_value);
|
||||
|
||||
s32 res = cellGcmSetPrepareFlip(ctx, id);
|
||||
s32 res = cellGcmSetPrepareFlip(CPU, ctx, id);
|
||||
vm::write32(gcm_info.label_addr + 0x10 * label_index, label_value);
|
||||
return res < 0 ? CELL_GCM_ERROR_FAILURE : CELL_OK;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ extern void cellGcmSetFlipHandler(vm::ptr<void(u32)> handler);
|
|||
extern void cellGcmSetVBlankHandler(vm::ptr<void(u32)> handler);
|
||||
extern s32 cellGcmAddressToOffset(u32 address, vm::ptr<u32> offset);
|
||||
extern s32 cellGcmSetDisplayBuffer(u32 id, u32 offset, u32 pitch, u32 width, u32 height);
|
||||
extern s32 cellGcmSetPrepareFlip(vm::ptr<CellGcmContextData> ctx, u32 id);
|
||||
extern s32 cellGcmSetPrepareFlip(PPUThread& CPU, vm::ptr<CellGcmContextData> ctx, u32 id);
|
||||
extern s32 cellGcmSetSecondVFrequency(u32 freq);
|
||||
extern u32 cellGcmGetLabelAddress(u8 index);
|
||||
extern u32 cellGcmGetTiledPitchSize(u32 size);
|
||||
|
@ -984,7 +984,7 @@ int cellRescSetSrc(s32 idx, vm::ptr<CellRescSrc> src)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int cellRescSetConvertAndFlip(vm::ptr<CellGcmContextData> cntxt, s32 idx)
|
||||
int cellRescSetConvertAndFlip(PPUThread& CPU, vm::ptr<CellGcmContextData> cntxt, s32 idx)
|
||||
{
|
||||
cellResc.Log("cellRescSetConvertAndFlip(cntxt_addr=0x%x, indx=0x%x)", cntxt.addr(), idx);
|
||||
|
||||
|
@ -1017,7 +1017,7 @@ int cellRescSetConvertAndFlip(vm::ptr<CellGcmContextData> cntxt, s32 idx)
|
|||
|
||||
//TODO: ?
|
||||
|
||||
cellGcmSetPrepareFlip(cntxt, idx);
|
||||
cellGcmSetPrepareFlip(CPU, cntxt, idx);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
|
|
@ -1018,7 +1018,7 @@ s32 cellSyncLFQueueInitialize(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u8> buffer
|
|||
return syncLFQueueInitialize(queue, buffer, size, depth, direction, eaSignal);
|
||||
}
|
||||
|
||||
s32 syncLFQueueGetPushPointer(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32 isBlocking, u32 useEventQueue)
|
||||
s32 syncLFQueueGetPushPointer(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32 isBlocking, u32 useEventQueue)
|
||||
{
|
||||
if (queue->m_direction != CELL_SYNC_QUEUE_PPU2SPU)
|
||||
{
|
||||
|
@ -1106,45 +1106,45 @@ s32 syncLFQueueGetPushPointer(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32
|
|||
}
|
||||
}
|
||||
|
||||
if (s32 res = sys_event_queue_receive(GetCurrentPPUThread(), queue->m_eq_id, vm::null, 0))
|
||||
if (s32 res = sys_event_queue_receive(CPU, queue->m_eq_id, vm::null, 0))
|
||||
{
|
||||
assert(!"sys_event_queue_receive() failed");
|
||||
throw __FUNCTION__;
|
||||
}
|
||||
var1 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
s32 _cellSyncLFQueueGetPushPointer(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> pointer, u32 isBlocking, u32 useEventQueue)
|
||||
s32 _cellSyncLFQueueGetPushPointer(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> pointer, u32 isBlocking, u32 useEventQueue)
|
||||
{
|
||||
cellSync.Warning("_cellSyncLFQueueGetPushPointer(queue=*0x%x, pointer=*0x%x, isBlocking=%d, useEventQueue=%d)", queue, pointer, isBlocking, useEventQueue);
|
||||
|
||||
s32 pointer_value;
|
||||
s32 result = syncLFQueueGetPushPointer(queue, pointer_value, isBlocking, useEventQueue);
|
||||
s32 result = syncLFQueueGetPushPointer(CPU, queue, pointer_value, isBlocking, useEventQueue);
|
||||
|
||||
*pointer = pointer_value;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
s32 syncLFQueueGetPushPointer2(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32 isBlocking, u32 useEventQueue)
|
||||
s32 syncLFQueueGetPushPointer2(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32 isBlocking, u32 useEventQueue)
|
||||
{
|
||||
throw __FUNCTION__;
|
||||
}
|
||||
|
||||
s32 _cellSyncLFQueueGetPushPointer2(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> pointer, u32 isBlocking, u32 useEventQueue)
|
||||
s32 _cellSyncLFQueueGetPushPointer2(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> pointer, u32 isBlocking, u32 useEventQueue)
|
||||
{
|
||||
// arguments copied from _cellSyncLFQueueGetPushPointer
|
||||
cellSync.Todo("_cellSyncLFQueueGetPushPointer2(queue=*0x%x, pointer=*0x%x, isBlocking=%d, useEventQueue=%d)", queue, pointer, isBlocking, useEventQueue);
|
||||
|
||||
s32 pointer_value;
|
||||
s32 result = syncLFQueueGetPushPointer2(queue, pointer_value, isBlocking, useEventQueue);
|
||||
s32 result = syncLFQueueGetPushPointer2(CPU,queue, pointer_value, isBlocking, useEventQueue);
|
||||
|
||||
*pointer = pointer_value;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
s32 syncLFQueueCompletePushPointer(vm::ptr<CellSyncLFQueue> queue, s32 pointer, std::function<s32(u32 addr, u32 arg)> fpSendSignal)
|
||||
s32 syncLFQueueCompletePushPointer(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, s32 pointer, std::function<s32(PPUThread& CPU, u32 addr, u32 arg)> fpSendSignal)
|
||||
{
|
||||
if (queue->m_direction != CELL_SYNC_QUEUE_PPU2SPU)
|
||||
{
|
||||
|
@ -1260,7 +1260,7 @@ s32 syncLFQueueCompletePushPointer(vm::ptr<CellSyncLFQueue> queue, s32 pointer,
|
|||
if (exch)
|
||||
{
|
||||
assert(fpSendSignal);
|
||||
return fpSendSignal((u32)queue->m_eaSignal.addr(), var6);
|
||||
return fpSendSignal(CPU, (u32)queue->m_eaSignal.addr(), var6);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1278,24 +1278,24 @@ s32 syncLFQueueCompletePushPointer(vm::ptr<CellSyncLFQueue> queue, s32 pointer,
|
|||
}
|
||||
}
|
||||
|
||||
s32 _cellSyncLFQueueCompletePushPointer(vm::ptr<CellSyncLFQueue> queue, s32 pointer, vm::ptr<s32(u32 addr, u32 arg)> fpSendSignal)
|
||||
s32 _cellSyncLFQueueCompletePushPointer(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, s32 pointer, vm::ptr<s32(u32 addr, u32 arg)> fpSendSignal)
|
||||
{
|
||||
cellSync.Warning("_cellSyncLFQueueCompletePushPointer(queue=*0x%x, pointer=%d, fpSendSignal=*0x%x)", queue, pointer, fpSendSignal);
|
||||
|
||||
return syncLFQueueCompletePushPointer(queue, pointer, fpSendSignal);
|
||||
return syncLFQueueCompletePushPointer(CPU, queue, pointer, fpSendSignal);
|
||||
}
|
||||
|
||||
s32 syncLFQueueCompletePushPointer2(vm::ptr<CellSyncLFQueue> queue, s32 pointer, std::function<s32(u32 addr, u32 arg)> fpSendSignal)
|
||||
s32 syncLFQueueCompletePushPointer2(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, s32 pointer, std::function<s32(PPUThread& CPU, u32 addr, u32 arg)> fpSendSignal)
|
||||
{
|
||||
throw __FUNCTION__;
|
||||
}
|
||||
|
||||
s32 _cellSyncLFQueueCompletePushPointer2(vm::ptr<CellSyncLFQueue> queue, s32 pointer, vm::ptr<s32(u32 addr, u32 arg)> fpSendSignal)
|
||||
s32 _cellSyncLFQueueCompletePushPointer2(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, s32 pointer, vm::ptr<s32(u32 addr, u32 arg)> fpSendSignal)
|
||||
{
|
||||
// arguments copied from _cellSyncLFQueueCompletePushPointer
|
||||
cellSync.Todo("_cellSyncLFQueueCompletePushPointer2(queue=*0x%x, pointer=%d, fpSendSignal=*0x%x)", queue, pointer, fpSendSignal);
|
||||
|
||||
return syncLFQueueCompletePushPointer2(queue, pointer, fpSendSignal);
|
||||
return syncLFQueueCompletePushPointer2(CPU, queue, pointer, fpSendSignal);
|
||||
}
|
||||
|
||||
s32 _cellSyncLFQueuePushBody(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, vm::cptr<void> buffer, u32 isBlocking)
|
||||
|
@ -1320,11 +1320,11 @@ s32 _cellSyncLFQueuePushBody(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, vm:
|
|||
|
||||
if (queue->m_direction != CELL_SYNC_QUEUE_ANY2ANY)
|
||||
{
|
||||
res = syncLFQueueGetPushPointer(queue, position, isBlocking, 0);
|
||||
res = syncLFQueueGetPushPointer(CPU, queue, position, isBlocking, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = syncLFQueueGetPushPointer2(queue, position, isBlocking, 0);
|
||||
res = syncLFQueueGetPushPointer2(CPU, queue, position, isBlocking, 0);
|
||||
}
|
||||
|
||||
if (!isBlocking || res != CELL_SYNC_ERROR_AGAIN)
|
||||
|
@ -1354,17 +1354,17 @@ s32 _cellSyncLFQueuePushBody(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, vm:
|
|||
|
||||
if (queue->m_direction != CELL_SYNC_QUEUE_ANY2ANY)
|
||||
{
|
||||
res = syncLFQueueCompletePushPointer(queue, position, nullptr);
|
||||
res = syncLFQueueCompletePushPointer(CPU, queue, position, nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = syncLFQueueCompletePushPointer2(queue, position, nullptr);
|
||||
res = syncLFQueueCompletePushPointer2(CPU, queue, position, nullptr);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
s32 syncLFQueueGetPopPointer(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32 isBlocking, u32, u32 useEventQueue)
|
||||
s32 syncLFQueueGetPopPointer(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32 isBlocking, u32, u32 useEventQueue)
|
||||
{
|
||||
if (queue->m_direction != CELL_SYNC_QUEUE_SPU2PPU)
|
||||
{
|
||||
|
@ -1452,45 +1452,45 @@ s32 syncLFQueueGetPopPointer(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32 i
|
|||
}
|
||||
}
|
||||
|
||||
if (s32 res = sys_event_queue_receive(GetCurrentPPUThread(), queue->m_eq_id, vm::null, 0))
|
||||
if (s32 res = sys_event_queue_receive(CPU, queue->m_eq_id, vm::null, 0))
|
||||
{
|
||||
assert(!"sys_event_queue_receive() failed");
|
||||
throw __FUNCTION__;
|
||||
}
|
||||
var1 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
s32 _cellSyncLFQueueGetPopPointer(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> pointer, u32 isBlocking, u32 arg4, u32 useEventQueue)
|
||||
s32 _cellSyncLFQueueGetPopPointer(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> pointer, u32 isBlocking, u32 arg4, u32 useEventQueue)
|
||||
{
|
||||
cellSync.Warning("_cellSyncLFQueueGetPopPointer(queue=*0x%x, pointer=*0x%x, isBlocking=%d, arg4=%d, useEventQueue=%d)", queue, pointer, isBlocking, arg4, useEventQueue);
|
||||
|
||||
s32 pointer_value;
|
||||
s32 result = syncLFQueueGetPopPointer(queue, pointer_value, isBlocking, arg4, useEventQueue);
|
||||
s32 result = syncLFQueueGetPopPointer(CPU, queue, pointer_value, isBlocking, arg4, useEventQueue);
|
||||
|
||||
*pointer = pointer_value;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
s32 syncLFQueueGetPopPointer2(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32 isBlocking, u32 useEventQueue)
|
||||
s32 syncLFQueueGetPopPointer2(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32 isBlocking, u32 useEventQueue)
|
||||
{
|
||||
throw __FUNCTION__;
|
||||
}
|
||||
|
||||
s32 _cellSyncLFQueueGetPopPointer2(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> pointer, u32 isBlocking, u32 useEventQueue)
|
||||
s32 _cellSyncLFQueueGetPopPointer2(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, vm::ptr<u32> pointer, u32 isBlocking, u32 useEventQueue)
|
||||
{
|
||||
// arguments copied from _cellSyncLFQueueGetPopPointer
|
||||
cellSync.Todo("_cellSyncLFQueueGetPopPointer2(queue=*0x%x, pointer=*0x%x, isBlocking=%d, useEventQueue=%d)", queue, pointer, isBlocking, useEventQueue);
|
||||
|
||||
s32 pointer_value;
|
||||
s32 result = syncLFQueueGetPopPointer2(queue, pointer_value, isBlocking, useEventQueue);
|
||||
s32 result = syncLFQueueGetPopPointer2(CPU, queue, pointer_value, isBlocking, useEventQueue);
|
||||
|
||||
*pointer = pointer_value;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
s32 syncLFQueueCompletePopPointer(vm::ptr<CellSyncLFQueue> queue, s32 pointer, std::function<s32(u32 addr, u32 arg)> fpSendSignal, u32 noQueueFull)
|
||||
s32 syncLFQueueCompletePopPointer(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, s32 pointer, std::function<s32(PPUThread& CPU, u32 addr, u32 arg)> fpSendSignal, u32 noQueueFull)
|
||||
{
|
||||
if (queue->m_direction != CELL_SYNC_QUEUE_SPU2PPU)
|
||||
{
|
||||
|
@ -1605,7 +1605,7 @@ s32 syncLFQueueCompletePopPointer(vm::ptr<CellSyncLFQueue> queue, s32 pointer, s
|
|||
if (exch)
|
||||
{
|
||||
assert(fpSendSignal);
|
||||
return fpSendSignal((u32)queue->m_eaSignal.addr(), var6);
|
||||
return fpSendSignal(CPU, (u32)queue->m_eaSignal.addr(), var6);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1623,25 +1623,25 @@ s32 syncLFQueueCompletePopPointer(vm::ptr<CellSyncLFQueue> queue, s32 pointer, s
|
|||
}
|
||||
}
|
||||
|
||||
s32 _cellSyncLFQueueCompletePopPointer(vm::ptr<CellSyncLFQueue> queue, s32 pointer, vm::ptr<s32(u32 addr, u32 arg)> fpSendSignal, u32 noQueueFull)
|
||||
s32 _cellSyncLFQueueCompletePopPointer(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, s32 pointer, vm::ptr<s32(u32 addr, u32 arg)> fpSendSignal, u32 noQueueFull)
|
||||
{
|
||||
// arguments copied from _cellSyncLFQueueCompletePushPointer + unknown argument (noQueueFull taken from LFQueue2CompletePopPointer)
|
||||
cellSync.Warning("_cellSyncLFQueueCompletePopPointer(queue=*0x%x, pointer=%d, fpSendSignal=*0x%x, noQueueFull=%d)", queue, pointer, fpSendSignal, noQueueFull);
|
||||
|
||||
return syncLFQueueCompletePopPointer(queue, pointer, fpSendSignal, noQueueFull);
|
||||
return syncLFQueueCompletePopPointer(CPU, queue, pointer, fpSendSignal, noQueueFull);
|
||||
}
|
||||
|
||||
s32 syncLFQueueCompletePopPointer2(vm::ptr<CellSyncLFQueue> queue, s32 pointer, std::function<s32(u32 addr, u32 arg)> fpSendSignal, u32 noQueueFull)
|
||||
s32 syncLFQueueCompletePopPointer2(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, s32 pointer, std::function<s32(PPUThread& CPU, u32 addr, u32 arg)> fpSendSignal, u32 noQueueFull)
|
||||
{
|
||||
throw __FUNCTION__;
|
||||
}
|
||||
|
||||
s32 _cellSyncLFQueueCompletePopPointer2(vm::ptr<CellSyncLFQueue> queue, s32 pointer, vm::ptr<s32(u32 addr, u32 arg)> fpSendSignal, u32 noQueueFull)
|
||||
s32 _cellSyncLFQueueCompletePopPointer2(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, s32 pointer, vm::ptr<s32(u32 addr, u32 arg)> fpSendSignal, u32 noQueueFull)
|
||||
{
|
||||
// arguments copied from _cellSyncLFQueueCompletePopPointer
|
||||
cellSync.Todo("_cellSyncLFQueueCompletePopPointer2(queue=*0x%x, pointer=%d, fpSendSignal=*0x%x, noQueueFull=%d)", queue, pointer, fpSendSignal, noQueueFull);
|
||||
|
||||
return syncLFQueueCompletePopPointer2(queue, pointer, fpSendSignal, noQueueFull);
|
||||
return syncLFQueueCompletePopPointer2(CPU, queue, pointer, fpSendSignal, noQueueFull);
|
||||
}
|
||||
|
||||
s32 _cellSyncLFQueuePopBody(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, vm::ptr<void> buffer, u32 isBlocking)
|
||||
|
@ -1665,11 +1665,11 @@ s32 _cellSyncLFQueuePopBody(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, vm::
|
|||
s32 res;
|
||||
if (queue->m_direction != CELL_SYNC_QUEUE_ANY2ANY)
|
||||
{
|
||||
res = syncLFQueueGetPopPointer(queue, position, isBlocking, 0, 0);
|
||||
res = syncLFQueueGetPopPointer(CPU, queue, position, isBlocking, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = syncLFQueueGetPopPointer2(queue, position, isBlocking, 0);
|
||||
res = syncLFQueueGetPopPointer2(CPU, queue, position, isBlocking, 0);
|
||||
}
|
||||
|
||||
if (!isBlocking || res != CELL_SYNC_ERROR_AGAIN)
|
||||
|
@ -1699,11 +1699,11 @@ s32 _cellSyncLFQueuePopBody(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, vm::
|
|||
|
||||
if (queue->m_direction != CELL_SYNC_QUEUE_ANY2ANY)
|
||||
{
|
||||
res = syncLFQueueCompletePopPointer(queue, position, nullptr, 0);
|
||||
res = syncLFQueueCompletePopPointer(CPU, queue, position, nullptr, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = syncLFQueueCompletePopPointer2(queue, position, nullptr, 0);
|
||||
res = syncLFQueueCompletePopPointer2(CPU, queue, position, nullptr, 0);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
|
|
@ -199,13 +199,13 @@ s32 syncRwmInitialize(vm::ptr<CellSyncRwm> rwm, vm::ptr<void> buffer, u32 buffer
|
|||
s32 syncQueueInitialize(vm::ptr<CellSyncQueue> queue, vm::ptr<u8> buffer, u32 size, u32 depth);
|
||||
|
||||
s32 syncLFQueueInitialize(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u8> buffer, u32 size, u32 depth, CellSyncQueueDirection direction, vm::ptr<void> eaSignal);
|
||||
s32 syncLFQueueGetPushPointer(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32 isBlocking, u32 useEventQueue);
|
||||
s32 syncLFQueueGetPushPointer2(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32 isBlocking, u32 useEventQueue);
|
||||
s32 syncLFQueueCompletePushPointer(vm::ptr<CellSyncLFQueue> queue, s32 pointer, std::function<s32(u32 addr, u32 arg)> fpSendSignal);
|
||||
s32 syncLFQueueCompletePushPointer2(vm::ptr<CellSyncLFQueue> queue, s32 pointer, std::function<s32(u32 addr, u32 arg)> fpSendSignal);
|
||||
s32 syncLFQueueGetPopPointer(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32 isBlocking, u32, u32 useEventQueue);
|
||||
s32 syncLFQueueGetPopPointer2(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32 isBlocking, u32 useEventQueue);
|
||||
s32 syncLFQueueCompletePopPointer(vm::ptr<CellSyncLFQueue> queue, s32 pointer, std::function<s32(u32 addr, u32 arg)> fpSendSignal, u32 noQueueFull);
|
||||
s32 syncLFQueueCompletePopPointer2(vm::ptr<CellSyncLFQueue> queue, s32 pointer, std::function<s32(u32 addr, u32 arg)> fpSendSignal, u32 noQueueFull);
|
||||
s32 syncLFQueueGetPushPointer(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32 isBlocking, u32 useEventQueue);
|
||||
s32 syncLFQueueGetPushPointer2(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32 isBlocking, u32 useEventQueue);
|
||||
s32 syncLFQueueCompletePushPointer(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, s32 pointer, std::function<s32(PPUThread& CPU, u32 addr, u32 arg)> fpSendSignal);
|
||||
s32 syncLFQueueCompletePushPointer2(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, s32 pointer, std::function<s32(PPUThread& CPU, u32 addr, u32 arg)> fpSendSignal);
|
||||
s32 syncLFQueueGetPopPointer(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32 isBlocking, u32, u32 useEventQueue);
|
||||
s32 syncLFQueueGetPopPointer2(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32 isBlocking, u32 useEventQueue);
|
||||
s32 syncLFQueueCompletePopPointer(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, s32 pointer, std::function<s32(PPUThread& CPU, u32 addr, u32 arg)> fpSendSignal, u32 noQueueFull);
|
||||
s32 syncLFQueueCompletePopPointer2(PPUThread& CPU, vm::ptr<CellSyncLFQueue> queue, s32 pointer, std::function<s32(PPUThread& CPU, u32 addr, u32 arg)> fpSendSignal, u32 noQueueFull);
|
||||
s32 syncLFQueueAttachLv2EventQueue(vm::ptr<u32> spus, u32 num, vm::ptr<CellSyncLFQueue> queue);
|
||||
s32 syncLFQueueDetachLv2EventQueue(vm::ptr<u32> spus, u32 num, vm::ptr<CellSyncLFQueue> queue);
|
||||
|
|
|
@ -148,7 +148,7 @@ int sceNpTrophyCreateHandle(vm::ptr<u32> handle)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sceNpTrophyRegisterContext(u32 context, u32 handle, vm::ptr<SceNpTrophyStatusCallback> statusCb, u32 arg_addr, u64 options)
|
||||
int sceNpTrophyRegisterContext(PPUThread& CPU, u32 context, u32 handle, vm::ptr<SceNpTrophyStatusCallback> statusCb, u32 arg_addr, u64 options)
|
||||
{
|
||||
sceNpTrophy.Warning("sceNpTrophyRegisterContext(context=0x%x, handle=0x%x, statusCb_addr=0x%x, arg_addr=0x%x, options=0x%llx)",
|
||||
context, handle, statusCb.addr(), arg_addr, options);
|
||||
|
@ -209,8 +209,8 @@ int sceNpTrophyRegisterContext(u32 context, u32 handle, vm::ptr<SceNpTrophyStatu
|
|||
ctxt.tropusr.reset(tropusr);
|
||||
|
||||
// TODO: Callbacks
|
||||
statusCb(context, SCE_NP_TROPHY_STATUS_INSTALLED, 100, 100, arg_addr);
|
||||
statusCb(context, SCE_NP_TROPHY_STATUS_PROCESSING_COMPLETE, 100, 100, arg_addr);
|
||||
statusCb(CPU, context, SCE_NP_TROPHY_STATUS_INSTALLED, 100, 100, arg_addr);
|
||||
statusCb(CPU, context, SCE_NP_TROPHY_STATUS_PROCESSING_COMPLETE, 100, 100, arg_addr);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
|
|
@ -42,8 +42,6 @@ struct lv2_lwcond_t
|
|||
REG_ID_TYPE(lv2_lwcond_t, 0x97); // SYS_LWCOND_OBJECT
|
||||
|
||||
// Aux
|
||||
void lwcond_create(sys_lwcond_t& lwcond, sys_lwmutex_t& lwmutex, u64 name);
|
||||
|
||||
class PPUThread;
|
||||
|
||||
// SysCalls
|
||||
|
|
|
@ -19,14 +19,6 @@ void sys_lwmutex_attribute_initialize(vm::ptr<sys_lwmutex_attribute_t> attr)
|
|||
attr->name[0] = '\0';
|
||||
}
|
||||
|
||||
void lwmutex_create(sys_lwmutex_t& lwmutex, bool recursive, u32 protocol, u64 name)
|
||||
{
|
||||
lwmutex.lock_var = { { lwmutex::free, lwmutex::zero } };
|
||||
lwmutex.attribute = protocol | (recursive ? SYS_SYNC_RECURSIVE : SYS_SYNC_NOT_RECURSIVE);
|
||||
lwmutex.recursive_count = 0;
|
||||
lwmutex.sleep_queue = Emu.GetIdManager().make<lv2_lwmutex_t>(protocol, name);
|
||||
}
|
||||
|
||||
s32 _sys_lwmutex_create(vm::ptr<u32> lwmutex_id, u32 protocol, vm::ptr<sys_lwmutex_t> control, u32 arg4, u64 name, u32 arg6)
|
||||
{
|
||||
sys_lwmutex.Warning("_sys_lwmutex_create(lwmutex_id=*0x%x, protocol=0x%x, control=*0x%x, arg4=0x%x, name=0x%llx, arg6=0x%x)", lwmutex_id, protocol, control, arg4, name, arg6);
|
||||
|
|
Loading…
Add table
Reference in a new issue