Commit Graph
12 Commits
Author SHA1 Message Date
Rookie 372f0f6c68 fix(libkernel): close a second rwlock wakeup race and loosen a condvar test
The last waiter to leave RwlockLock cleared the waiter bit outside the
bucket lock. If a new waiter published that same bit and incremented
the blocked count in the window between the decrement and the clear,
the clear erased its bit and a later unlock woke nobody. Re-check the
blocked count after clearing and restore the bit if a waiter appeared
in that window.

ConditionWaitRejectsAPriorityProtectedMutexWithoutLeakingAWaiter also
required the priority-protected wait to throw; a condition wait on
such a mutex is a valid, merely unsupported form, so only the queue
cleanliness is asserted now. Extended the rwlock stress test to 8
threads and more, shorter rounds to give the window more chances to
show up.

Depends on: none
2026-10-31 19:52:34 +01:00
Rookie 4ed0f9f911 fix(libkernel): close a rwlock wakeup race and a dangling condvar waiter
RwlockLock set its waiter bit unconditionally after deciding the lock
was unheld, so an unlock landing in that window woke nobody and the
waiter published its bit onto an already-free lock and slept forever.
Set the bit with a CAS against the value just checked, retrying the
freedom check on failure, as the mutex path already does for
UMUTEX_CONTESTED.

ConditionWait queues its stack waiter and drops the bucket lock before
calling MutexUnlock; MutexUnlock throws for a priority-protected
umutex, which unwound past the cleanup that removes the queue entry,
leaving a dangling pointer for a later ConditionWake to use. Reject
the unsupported mutex before the waiter is queued.

Depends on: none
2026-10-31 19:52:34 +01:00
Rookie 45a8b80a5c fix(libkernel): honour URWLOCK_PREFER_READER passed with RW_RDLOCK as the console does 2026-10-31 19:52:34 +01:00
Rookie 6f6c18b66f feat(libkernel): implement the umutex, condition variable and rwlock _umtx_op operations as the console does 2026-10-31 19:52:34 +01:00
boykopovar f38d29fd08 refactor(sdk): add canonical headers for remaining libraries 2026-10-24 23:17:42 +03:00
Aryan SharmaandClaude Haiku 5.5 4313a703ec feat(libkernel): implement _umtx_op UMTX_OP_SEM_WAIT and UMTX_OP_SEM_WAKE
Follow FreeBSD 11's do_sem_wait and do_sem_wake (COMPAT_FREEBSD9/10) on
a struct _usem: a wait sets _has_waiters, returns at once while _count
is non-zero and otherwise sleeps on the semaphore's queue; a wake clears
_has_waiters when one waiter is left and releases one waiter.

Co-Authored-By: Claude Haiku 5.5 <[email protected]>
2026-10-20 15:01:48 +05:30
ionut27001 e6613cfb8e fix(libkernel): fail _umtx_op operation 1 with EOPNOTSUPP as measured on a PS5
Operation 1 threw as unverified, so a title whose call_once path reaches it
stopped. In a payload process on a PS5 (firmware 12.70) operations 0 and 1
fail with EOPNOTSUPP and leave the word unchanged for every word tried,
as FreeBSD 11's __umtx_op_unimpl does. Answer operation 1 like operation 0.
2026-10-19 13:08:33 +03:00
Leonardo 4b34a6d5a7 feat(libkernel): support microsecond timeout in size-0 _umtx_op 2026-10-14 22:51:54 +02:00
Semir Kabir e92547a7a1 feat(libkernel): wake each listed address in _umtx_op UMTX_OP_NWAKE_PRIVATE 2026-10-11 17:48:06 +00:00
Adrià Franch 3879e7ed54 fix(libkernel): throw on a size-0 _umtx_op timeout that is not a valid timespec 2026-10-11 11:13:33 +02:00
Hannah Lyons 93cb3a1b0d fix(libkernel): compare the full WAIT_UINT value and throw on _umtx_op operation 1 2026-10-11 11:13:09 +02:00
clem-gbandClaude Opus 5.5 79f90f3d9b feat(libkernel): implement _umtx_op wait and wake operations
Titles that ship their own libc.prx or Unity's PS5Util.prx import
_umtx_op (04AjkP0jO9U) for atomic waits, call_once and futex-style
waits. Implement UMTX_OP_WAIT, UMTX_OP_WAKE, UMTX_OP_WAIT_UINT,
UMTX_OP_WAIT_UINT_PRIVATE and UMTX_OP_WAKE_PRIVATE as FreeBSD 11's
kern_umtx.c does, on the sceKernelSyncOnAddressWait waiter queue.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HeC9bA3n74TzJRYv9AgBE8
2026-10-11 11:13:08 +02:00