1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-23 19:22:48 +01:00

Added cellSync2 attribute initilization

Also added checks for EstimateBufferSize functions
This commit is contained in:
Raul Tambre 2014-09-04 18:27:19 +03:00
parent c51e52614e
commit e6ab29346e
2 changed files with 108 additions and 16 deletions

View File

@ -15,24 +15,36 @@ u32 libsync2;
u32 libsync2_rtoc;
#endif
s64 _cellSync2MutexAttributeInitialize()
s64 _cellSync2MutexAttributeInitialize(vm::ptr<CellSync2MutexAttribute> attr)
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x16A0, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
cellSync2->Warning("_cellSync2MutexAttributeInitialize(attr_addr=0x%x)", attr.addr());
attr->threadTypes = CELL_SYNC2_THREAD_TYPE_PPU_THREAD | CELL_SYNC2_THREAD_TYPE_PPU_FIBER |
CELL_SYNC2_THREAD_TYPE_SPURS_TASK | CELL_SYNC2_THREAD_TYPE_SPURS_JOB |
CELL_SYNC2_THREAD_TYPE_SPURS_JOBQUEUE_JOB;
attr->maxWaiters = 15;
attr->recursive = false;
strcpy(attr->name, "CellSync2Mutex");
return CELL_OK;
#endif
}
s64 cellSync2MutexEstimateBufferSize()
s64 cellSync2MutexEstimateBufferSize(vm::ptr<CellSync2MutexAttribute> attr, u64 bufferSize)
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0xC3C, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
cellSync2->Todo("cellSync2MutexEstimateBufferSize(attr_addr=0x%x, bufferSize=%d)", attr.addr(), bufferSize);
if (attr->maxWaiters > 32768)
return CELL_SYNC2_ERROR_INVAL;
return CELL_OK;
#endif
}
@ -92,24 +104,32 @@ s64 cellSync2MutexUnlock()
#endif
}
s64 _cellSync2CondAttributeInitialize()
s64 _cellSync2CondAttributeInitialize(vm::ptr<CellSync2CondAttribute> attr)
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x26DC, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
cellSync2->Warning("_cellSync2CondAttributeInitialize(attr_addr=0x%x)", attr.addr());
attr->maxWaiters = 15;
strcpy(attr->name, "CellSync2Cond");
return CELL_OK;
#endif
}
s64 cellSync2CondEstimateBufferSize()
s64 cellSync2CondEstimateBufferSize(vm::ptr<CellSync2CondAttribute> attr, u64 bufferSize)
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x1B90, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
cellSync2->Todo("cellSync2MutexEstimateBufferSize(attr_addr=0x%x, bufferSize=%d)", attr.addr(), bufferSize);
if (attr->maxWaiters == 0 || attr->maxWaiters > 32768)
return CELL_SYNC2_ERROR_INVAL;
return CELL_OK;
#endif
}
@ -169,24 +189,35 @@ s64 cellSync2CondSignalAll()
#endif
}
s64 _cellSync2SemaphoreAttributeInitialize()
s64 _cellSync2SemaphoreAttributeInitialize(vm::ptr<CellSync2SemaphoreAttribute> attr)
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x5644, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
cellSync2->Warning("_cellSync2SemaphoreAttributeInitialize(attr_addr=0x%x)", attr.addr());
attr->threadTypes = CELL_SYNC2_THREAD_TYPE_PPU_THREAD | CELL_SYNC2_THREAD_TYPE_PPU_FIBER |
CELL_SYNC2_THREAD_TYPE_SPURS_TASK | CELL_SYNC2_THREAD_TYPE_SPURS_JOB |
CELL_SYNC2_THREAD_TYPE_SPURS_JOBQUEUE_JOB;
attr->maxWaiters = 1;
strcpy(attr->name, "CellSync2Semaphore");
return CELL_OK;
#endif
}
s64 cellSync2SemaphoreEstimateBufferSize()
s64 cellSync2SemaphoreEstimateBufferSize(vm::ptr<CellSync2SemaphoreAttribute> attr, u64 bufferSize)
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x4AC4, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
cellSync2->Todo("cellSync2MutexEstimateBufferSize(attr_addr=0x%x, bufferSize=%d)", attr.addr(), bufferSize);
if (attr->maxWaiters == 0 || attr->maxWaiters > 32768)
return CELL_SYNC2_ERROR_INVAL;
return CELL_OK;
#endif
}
@ -257,24 +288,39 @@ s64 cellSync2SemaphoreGetCount()
#endif
}
s64 _cellSync2QueueAttributeInitialize()
s64 _cellSync2QueueAttributeInitialize(vm::ptr<CellSync2QueueAttribute> attr)
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x3C5C, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
cellSync2->Warning("_cellSync2QueueAttributeInitialize(attr_addr=0x%x)", attr.addr());
attr->threadTypes = CELL_SYNC2_THREAD_TYPE_PPU_THREAD | CELL_SYNC2_THREAD_TYPE_PPU_FIBER |
CELL_SYNC2_THREAD_TYPE_SPURS_TASK | CELL_SYNC2_THREAD_TYPE_SPURS_JOB |
CELL_SYNC2_THREAD_TYPE_SPURS_JOBQUEUE_JOB;
attr->elementSize = 16;
attr->depth = 1024;
attr->maxPushWaiters = 15;
attr->maxPopWaiters = 15;
strcpy(attr->name, "CellSync2Queue");
return CELL_OK;
#endif
}
s64 cellSync2QueueEstimateBufferSize()
s64 cellSync2QueueEstimateBufferSize(vm::ptr<CellSync2QueueAttribute> attr, u64 bufferSize)
{
#ifdef PRX_DEBUG
cellSync2->Warning("%s()", __FUNCTION__);
return GetCurrentPPUThread().FastCall2(libsync2 + 0x2A98, libsync2_rtoc);
#else
UNIMPLEMENTED_FUNC(cellSync2);
cellSync2->Todo("cellSync2MutexEstimateBufferSize(attr_addr=0x%x, bufferSize=%d)", attr.addr(), bufferSize);
if (attr->elementSize == 0 || attr->elementSize > 16384 || !attr->elementSize % 16 || attr->depth == 0 || attr->depth > 4294967292 ||
attr->maxPushWaiters > 32768 || attr->maxPopWaiters > 32768)
return CELL_SYNC2_ERROR_INVAL;
return CELL_OK;
#endif
}

View File

@ -15,4 +15,50 @@ enum
CELL_SYNC2_ERROR_NOT_SUPPORTED_THREAD = 0x80410C12,
CELL_SYNC2_ERROR_NO_NOTIFIER = 0x80410C13,
CELL_SYNC2_ERROR_NO_SPU_CONTEXT_STORAGE = 0x80410C14,
};
// Constants
enum
{
CELL_SYNC2_NAME_MAX_LENGTH = 31,
CELL_SYNC2_THREAD_TYPE_PPU_THREAD = 1 << 0,
CELL_SYNC2_THREAD_TYPE_PPU_FIBER = 1 << 1,
CELL_SYNC2_THREAD_TYPE_SPURS_TASK = 1 << 2,
CELL_SYNC2_THREAD_TYPE_SPURS_JOBQUEUE_JOB = 1 << 3,
CELL_SYNC2_THREAD_TYPE_SPURS_JOB = 1 << 8,
};
struct CellSync2MutexAttribute
{
be_t<u16> threadTypes;
be_t<u16> maxWaiters;
bool recursive;
char name[CELL_SYNC2_NAME_MAX_LENGTH + 1];
u8 reserved[];
};
struct CellSync2CondAttribute
{
be_t<u16> maxWaiters;
char name[CELL_SYNC2_NAME_MAX_LENGTH + 1];
u8 reserved[];
};
struct CellSync2SemaphoreAttribute
{
be_t<u16> threadTypes;
be_t<u16> maxWaiters;
char name[CELL_SYNC2_NAME_MAX_LENGTH + 1];
u8 reserved[];
};
struct CellSync2QueueAttribute
{
be_t<u32> threadTypes;
be_t<u64> elementSize;
be_t<u32> depth;
be_t<u16> maxPushWaiters;
be_t<u16> maxPopWaiters;
char name[CELL_SYNC2_NAME_MAX_LENGTH + 1];
u8 reserved[];
};