388 Commits
Author SHA1 Message Date
Adrià 578b8311ac Merge pull request #11267 from kallmek3nny/feat/libkernel-sem-setname
feat(libkernel): implement sem_setname
2026-10-29 11:31:34 +01:00
Dean 711c4eca09 Merge pull request #11785 from ionut27001/fix/libc-hardware-concurrency
fix(libc): return the CPU count of the default thread mask from std::thread::hardware_concurrency
2026-10-29 12:16:46 +13:00
kenny soloandClaude Opus 5.5 20c9a93999 feat(libkernel): implement sem_setname
Keep a copy of the name with the semaphore and move the export from the libkernel_sys stub into libkernel next to the other sem_* exports.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-28 14:51:17 +01:00
Dean bc7cc27e55 Merge pull request #10856 from Felipebmaitan/feat/guest-signal-cancellation
fix(libkernel): avoid cancellation wakeups during thread exit
2026-10-28 22:52:08 +13:00
Dean 4a6693acf8 Merge pull request #12083 from KernelPanicNT/fix/libkernel-mutexattr-setkind-any-kind
fix(libkernel): store any scePthreadMutexattrSetkind kind as firmware 13.42 does
2026-10-28 22:46:46 +13:00
Felipebmaitan 4ba0a6f9c4 chore: integrate current main for guest-signal-cancellation 2026-10-28 00:48:38 -03:00
Dean e778405b5b Merge pull request #11592 from alvaroelpob/fix/libkernel-condattr-getclock-einval
fix(libkernel): fail pthread_condattr_getclock with EINVAL for a null attribute
2026-10-28 13:04:04 +13:00
KernelPanicNT 625a3fbb62 fix(libkernel): store any scePthreadMutexattrSetkind kind as firmware 13.42 does
scePthreadMutexattrSetkind called NotImplemented_nid_no_patch for a kind
outside 1 to 4. Firmware 13.42's libkernel, run in an emulator, makes it
call pthread_mutexattr_setkind_np, which stores any kind as a signed
16-bit value and returns 0, and turns a null attribute's -1 with errno 22
into 0x8001FFFF. It now forwards to pthread_mutexattr_setkind_np and
converts the result with sceKernelError, so a null attribute or object
still returns 0x8001FFFF and now also sets errno 22.

An out-of-range kind is refused by scePthreadMutexInit with 0x80020016,
leaving the mutex untouched, as measured for the same module.
scePthreadMutexattrGetkind is unchanged; kind 0 now reaches it and
returns 0.
2026-10-27 19:24:23 +00:00
KernelPanicNT 9ed4377be4 Merge main into fix/libkernel-mutexattr-setkind-any-kind 2026-10-27 19:22:42 +00:00
Adrià e2a5118839 Merge pull request #11047 from imellag/feat/libkernel-macho-tls
feat(libkernel): thread-local storage for Mach-O guests
2026-10-27 15:18:46 +01:00
Adrià 1089f2bbfd Merge pull request #11039 from orezraey/fix/libkernel-mutex-yieldloops-destroyed-measured-ps5
fix(libkernel): fail the yield loop setter on a destroyed mutex as measured on a PS5
2026-10-27 14:08:31 +01:00
Adrià FranchandClaude Sonnet 5.5 c8cac8e090 fix(libkernel): initialise the CPU model before reading AVX support for guest TLS
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-27 08:42:09 +01:00
Emanueleandmugurc 86cdfb8647 feat(libkernel): thread-local storage for Mach-O guests
FreeBSD code reaches its thread pointer through %fs and macOS cannot set
the fs base. The macOS relinker turns each %fs access of a guest image
into a stub that reads the thread pointer from a pthread key and calls
Aps5GuestTlsAllocate on a thread's first access, registers the TLS
descriptor of an image with Aps5GuestTlsRegister, and routes
__tls_get_addr to Aps5GuestTlsGetAddr. No library provided them, so a
relinked executable could not start.

- Aps5GuestTlsRegister validates the descriptor the relinker wrote and
  creates the key; its destructor frees the block of a thread.
- Aps5GuestTlsAllocateThreadPointer allocates the block (the TLS template
  followed by zeros, then a 0x100-byte thread control block whose first
  word points at itself, as on FreeBSD) and stores the thread pointer
  under the key.
- Aps5GuestTlsAllocate is the entry the stubs call: rax holds the
  descriptor and returns the thread pointer, every other register is
  preserved, the upper halves of the ymm registers only where AVX exists.
- Aps5GuestTlsGetAddr returns the block of the thread plus the offset.

Co-authored-by: mugurc <[email protected]>
2026-10-27 08:42:04 +01:00
Adrià 5c356f41c3 Merge pull request #11048 from imellag/feat/libkernel-macos-main-thread
feat(libkernel): start the guest off the main thread on macOS
2026-10-27 08:27:20 +01:00
ionut27001 fc8fc19125 fix(libc): return the CPU count of the default thread mask from std::thread::hardware_concurrency 2026-10-27 09:26:20 +02:00
orezraeyandClaude Opus 5.5 cf1771ec7e Merge main into fix/libkernel-mutex-yieldloops-destroyed-measured-ps5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 23:10:34 -03:00
Dean af2a996527 Merge pull request #11263 from orezraey/fix/libkernel-cond-signalto-measured-ps5
fix(libkernel): fail scePthreadCondSignalto for a null or non-waiting thread as measured on a PS5
2026-10-27 15:01:44 +13:00
Dean 8056827ea8 Merge pull request #10133 from orezraey/fix/libkernel-posix-thread-attr-measured-ps5
fix(libkernel): follow the thread priority ranges and POSIX attribute errors measured on a PS5
2026-10-27 14:58:57 +13:00
Dean 6e98696398 Merge pull request #10061 from elieh999/fix/rwlockattr-destroyed-pshared
fix(libkernel): preserve destroyed rwlock attributes
2026-10-27 14:58:42 +13:00
Dean 86a38cdf6c Merge pull request #9187 from slider/feat/libkernel-sched-params
feat(libkernel): implement sched_getparam, sched_getscheduler and sched_setparam for the calling thread
2026-10-27 14:57:32 +13:00
Dean ad1caa840c Merge pull request #10385 from alvaroelpob/feat/libkernel-pthread-setname
feat(libkernel): implement pthread_mutex_setname_np, pthread_rwlock_setname_np and pthread_barrier_setname_np
2026-10-27 10:54:00 +13:00
Dean dd248b02ed Merge pull request #11201 from orezraey/fix/libkernel-pthread-create-long-name-handle-measured-ps5
fix(libkernel): clear the thread handle when scePthreadCreate rejects a long name as measured on a PS5
2026-10-27 10:39:25 +13:00
Alvaro a0eaec6611 fix(libkernel): fail pthread_condattr_getclock with EINVAL for a null attribute
pthread_condattr_getclock threw for a null attribute pointer or a null
handle. FreeBSD 11.4 libthr (lib/libthr/thread/thr_condattr.c) returns
EINVAL for both before reading the clock, as setclock, setpshared,
getpshared and destroy here already do. A null output pointer with a
valid attribute faults on FreeBSD, so it still throws.
2026-10-26 22:34:15 +01:00
Piyush Sagar 947e72e4d7 feat(libkernel): implement pthread_condattr_getclock 2026-10-26 21:44:53 +05:30
Adrià 7903201bb4 Merge pull request #10130 from orezraey/fix/libkernel-pthread-attr-measured-ps5
fix(libkernel): report thread attribute inheritance and null-output errors as measured on a PS5
2026-10-26 15:45:11 +01:00
Alvaro cf2aa7c362 fix(libkernel): return EAGAIN when renaming a named mutex, rwlock or barrier 2026-10-26 15:39:49 +01:00
Alvaro 20ead24d8b refactor(libkernel): declare the setname exports in the public header 2026-10-26 15:37:37 +01:00
Alvaro 5c30b97440 feat(libkernel): implement pthread_barrier_setname_np 2026-10-26 15:37:26 +01:00
Alvaro a27cecc950 feat(libkernel): implement pthread_rwlock_setname_np 2026-10-26 15:37:26 +01:00
Alvaro d100cdaf52 feat(libkernel): implement pthread_mutex_setname_np 2026-10-26 15:36:49 +01:00
orezraeyandClaude Opus 5.5 60b9e7f43f Merge main into fix/libkernel-posix-thread-attr-measured-ps5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 11:07:59 -03:00
Adrià 9656d366be Merge pull request #9962 from kallmek3nny/feat/libkernel-pthread-cond-setname-np
feat(libkernel): add pthread_cond_setname_np
2026-10-26 14:42:29 +01:00
Adrià e796ed4e5e Merge pull request #9632 from EagleBearerYS/feat/libkernel-sys-libthr-names
feat(libkernel): add pthread_rwlockattr_settype_np and scePthreadMutexattrSetkind
2026-10-26 11:20:50 +01:00
Dean 4c752cafc9 Merge pull request #10177 from orezraey/fix/libkernel-cond-destroyed-measured-ps5
fix(libkernel): mark a destroyed condition variable with 1 and accept destroying a null one, as measured on a PS5
2026-10-26 21:29:48 +13:00
Elie Helou 3c797c52ce fix(libkernel): reject destroyed rwlockattr getters 2026-10-26 07:27:09 +02:00
elie helou 8aa531d173 fix(libkernel): reject destroyed rwlockattr settype 2026-10-26 07:21:14 +02:00
elieh999 3d5e75ab39 fix(libkernel): reject mixed rwlockattr destruction 2026-10-26 07:20:47 +02:00
elieh999 e6a11ba6de fix(libkernel): preserve destroyed rwlock attributes 2026-10-26 07:20:28 +02:00
kenny soloandClaude Opus 5.5 15ed96d647 fix(libkernel): stop storing the pthread_cond_setname_np name
scePthreadCondInit ignores its name and nothing reads a condition variable name back, so pthread_cond_setname_np now only validates the condition variable and the name. Drops the stale libkernel_sys declaration and moves the debt entry to Silent stubs, citing shadPS4.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-25 20:41:35 -04:00
kenny soloandClaude Opus 5.5 70557b2e16 feat(libkernel): add pthread_cond_setname_np
Store the name on the condition variable, creating a statically initialized one first, and return EINVAL for a destroyed one. A null cond or a null name throws, recorded in the libkernel debt file.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-25 20:41:35 -04:00
orezraeyandClaude Opus 5.5 9797a214b0 fix(libkernel): fail scePthreadCondSignalto for a null or non-waiting thread as measured on a PS5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 19:56:40 -03:00
Dean de2e6728f3 Merge pull request #8616 from Lindamea1/fix/libkernel-posix-sem-post-notify-under-lock
fix(libkernel): notify a POSIX semaphore waiter before sem_post releases its lock
2026-10-26 11:02:29 +13:00
orezraeyandClaude Opus 5.5 3836941fb2 fix(libkernel): clear the thread handle when scePthreadCreate rejects a long name as measured on a PS5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 18:40:40 -03:00
Yunus Shaikh 3a47ea6ea4 Merge main into feat/libkernel-sys-libthr-names
Main's #9573 implements scePthreadResume right after the
scePthreadMutexattrSetkind stub this branch removes from libkernel_sys;
the merge takes main's scePthreadResume and leaves the stub out.

Main's public-header audit wants one header declaration per export, so
the merge declares this branch's scePthreadMutexattrSetkind,
scePthreadMutexattrGetkind and pthread_rwlockattr_settype_np in
libkernel's Api.hpp, drops their stub declarations from libkernel_sys's
Api.hpp, has Mutex.cpp take sceKernelError from libkernel's Api.hpp,
and has the test include the libkernel headers instead of its own
declarations.
2026-10-25 12:49:51 -07:00
orezraeyandClaude Opus 5.5 496d29622c Merge main into fix/libkernel-posix-thread-attr-measured-ps5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 16:44:57 -03:00
orezraeyandClaude Opus 5.5 3345e2047d Merge main into fix/libkernel-pthread-attr-measured-ps5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 16:32:10 -03:00
Adrià aeff26bd97 Merge pull request #9573 from zaryabzip/feat/pthread-create-suspended
feat(libkernel_sys): create threads suspended and resume them
2026-10-25 20:21:07 +01:00
Adrià 7a25f87620 Merge pull request #9500 from GitamarT045T3R/fix/libkernel-condattr-setclock
fix(libkernel): reject clocks libthr does not accept in pthread_condattr_setclock
2026-10-25 18:42:46 +01:00
zaryabzip 0b60e97834 feat(libkernel_sys): create threads suspended and resume them
Implement pthread_attr_setcreatesuspend_np, pthread_resume_np,
pthread_resume_all_np and pthread_multi_np with the sce forms
scePthreadAttrSetcreatesuspend, scePthreadResume, scePthreadResumeAll
and scePthreadMulti, following FreeBSD 11.4 libthr and the firmware
13.42 libkernel_sys module. A thread created suspended waits before its
start routine, outside any cancellation point, until it is resumed.
sceKernelRaiseException throws on Windows for a thread still suspended
at creation.
2026-10-25 21:51:02 +05:00
Dean Galvin cfd525426c Merge branch 'main' into pr9187 2026-10-26 05:32:47 +13:00