libkernel: pthread spinlocks and pthread_cond_reltimedwait_np are absent (Porpoise, RetroArch); fix branch ready #3554
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-11T13:06:43Z.
libkernel does not export the
pthread_spin_*family (initZMn3clnAGBA,destroyIJIggoPZExk,lockpw+70ClLYlY,trylockrCTGkBIHfPY,unlockLEfMMCT+SlM) orpthread_cond_reltimedwait_np(K953PF5u6Pc). From the relink registry order they are the predicted next stops of Porpoise (PPSA99764:K953PF5u6Pcat index 384, thenpw+70ClLYlYat 387) and RetroArch (PPSA99169, indices 490 and 493); not yet observed in a run.Fix branch ready:
screamm:feat/libkernel-spin-reltimedwait(two commits onmaina11c8f7f:13ebf7f9feat(libkernel): implement the pthread spinlock calls,c86ec841feat(libkernel): implement pthread_cond_reltimedwait_np). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commits as they are. The only prior art is the bulk intake-closed #3293.Pthread/Posix/Spinlock.cpp, no SCE twin exists in aerolib): FreeBSD 11.4 libthrthr_pspinlock.c/thr_umtx.h(8c639945):EINVALfor null/uninitialised/destroyed locks and apsharedoutside 0 or 1,ENOMEMon allocation failure,EBUSYfrom trylock whenever held (including by the caller),EPERMfrom unlock by a non-holder, a spin that yields every 100000 checks like libthr'sSPIN_COUNT; a holder locking again throws where libthr would spin forever;PTHREAD_PROCESS_SHAREDgets an ordinary allocation (one process). The guestpthread_spinlock_tholds a pointer to the allocated lock like the other pthread types here.pthread_cond_reltimedwait_np(cond, mutex, timeout)callsscePthreadCondTimedwaitand returns POSIX errors; the third argument is microseconds, following shadPS4condvar.cpp(3a9f5726), which registers one function for this NID andscePthreadCondTimedwait; width 32-bit as the SCE twin andsem_reltimedwait_nphere. Both choices are in TechnicalDebt.guest_pthread_spin(argument errors, bothpsharedvalues,EPERM/EBUSYrules, the double-lock throw, cross-thread trylock/unlock, two threads × 200000 increments);guest_cond_timedwaitgainsEPERMwithout the mutex, a 50 ms and a zero timeout returningETIMEDOUTwith the mutex held, and a signal waking a 10 s wait.Tested on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release,
BUILD_TESTING=ON, full build includinglibs: the four pthread tests 3/3;ctest -j8 -E "^agc_driver_|^video_out_flip"533/537, the failures being the knownwindows_exceptions(#3411),guest_kernel_sys(#3510),guest_filesystem(#3518) and theagc_driverheap flake (#3171); withmain'sCond.cppthe extended cond test fails;tools/check_conventions.py --base mainandgit diff --checkpass. Not run on Linux.Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).
Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-11T14:01:57Z.
Independent verification on Linux (the gap noted in the report): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON.main— no rebase needed, the commit (c86ec8417) is unchanged.tools/check_conventions.py --base origin/mainandgit diff --checkpass.The branch is also mirrored at
blawesom:verify/3554for anyone carrying.