Files
AnyPS5/docs/dev/debt/libSceUlt.md
T
StoneDC 08fd4fe766 fix(libSceUlt): separate blocked queue pushers from poppers
sceUltGetQueueInfo reported every blocked queue thread as a waiting popper because both directions incremented one counter. Track the two wait classes in separate fields and fill both query outputs, copy one waiter record per blocked thread, and cover full-queue and empty-queue waits with a new queue-waiters test. sceUltGetUlthreadRuntimeInfo now throws when a caller asks for worker thread handles, since this runtime starts no worker threads, and the debt entry records the remaining limitations.
2026-10-26 22:06:56 +08:00

4.9 KiB

libSceUlt technical debt

Unknown function info

  • Bound condition variables use the creation-time mutex, inferred from PPSA28061 callers of _sceUltConditionVariableCreate; the wait caller reloads only the condition argument. Error precedence, busy/state errors, FIFO signal selection and unsupported recursive waits have not been measured on PS5 hardware. Non-null options and waits at recursion depth above one throw. A live condition prevents destroying its bound mutex. Finalization follows the existing host mutex lifecycle: it invalidates conditions and wakes queued or reacquiring waiters with a state error. Scheduling priority and build-version validation are not implemented.

  • libSceUlt ulthreads - Runtime option defaults still omit the native header, stack size, worker affinity and priority fields; affinity depends on unresolved process configuration queries. Concurrent join ownership is not modeled: the native runtime distinguishes an ordinary running thread from one with another joiner. Host threads do not use the guest context or worker scheduler.

  • libSceUlt queues - Queue-data pool destruction and shared slot limits still require comparison with the native node allocator.

  • sceUltConditionVariableCreate and sceUltConditionVariableOptParamInitialize (libSceUlt) are absent from the console export list, where only the underscored variants _sceUltConditionVariableCreate and _sceUltConditionVariableOptParamInitialize appear; their non-underscored signatures are assumed. Condition variable option parameter initialization only zeroes 128 bytes, and its layout without the common header remains unverified on hardware.

  • Status query exports (sceUltGetConditionVariableInfo, sceUltGetMutexInfo, sceUltGetQueueDataResourcePoolInfo, sceUltGetQueueInfo, sceUltGetReaderWriterLockInfo, sceUltGetSemaphoreInfo, sceUltGetUlthreadInfo, sceUltGetUlthreadRuntimeInfo and sceUltGetWaitingQueueResourcePoolInfo) populate recovered structure layouts and return ULT_ERROR_NULL or ULT_ERROR_STATE on absent objects. sceUltGetQueueInfo counts blocked pushers and poppers in their separate fields, but the waiter records it copies only carry their size: host waiters are not enumerated, so no thread identity, wait type or wait value is reported. sceUltGetUlthreadRuntimeInfo throws when the caller supplies a non-empty worker thread array, because this runtime starts no worker threads and has no handles to return. Waiting thread arrays and hardware priority accounting remain unverified on PS5 hardware.

  • Ult factory and creation exports without a leading underscore are absent from the supplied module; their signatures remain unresolved. Diagnostic signatures and synchronization argument lists are recovered.

  • sceUltMutexTryLock, the reader-writer lock and sceUltUlthreadGetSelf, sceUltUlthreadYield and sceUltUlthreadExit (libSceUlt) - the signatures follow the PS Vita libult in RPCS3 (a 256-byte lock and 128-byte option structures), not a PS5 binary. The rules are assumed: readers may take the lock while a writer waits, a thread that holds the write lock gets ULT_ERROR_STATE for any further lock instead of waiting on itself, a reader asking for the write lock waits on its own read lock, and the try forms return ULT_ERROR_BUSY. Outside an ulthread, sceUltUlthreadGetSelf, sceUltUlthreadYield and sceUltUlthreadExit return ULT_ERROR_STATE; inside one they act on the guest thread it runs on, since ulthreads are not scheduled cooperatively here

Functional

  • sceUltFinalize - allocator-failure behavior is unverified on a PS5. The host may throw std::bad_alloc while reserving temporary wake lists; guest waiting-pool exhaustion and native finalization errors are not modeled.
  • libSceUlt queues use preallocated host storage instead of the supplied guest work area; the guest object layouts remain incomplete. Waiting-queue pool thread limits and waiter priority ordering are not implemented. Finalization wakes blocked queue callers with ULT_ERROR_STATE.
  • sceUltWaitingQueueResourcePoolDestroy refuses with ULT_ERROR_STATE only when a thread is currently waiting on a pool-backed mutex, semaphore or queue, matching the PS5 libSceUlt disassembly (0x473a in or55417wcDk); bound but idle objects do not block pool destruction. Waiting-queue pool guest work area node accounting is not implemented.