Commit Graph
481 Commits
Author SHA1 Message Date
Dean 5e2f04007b Merge pull request #9326 from erickerxhalli/feat/libkernel-mutex-prioceiling
feat(libkernel): implement pthread_mutex_getprioceiling and setprioceiling
2026-11-05 08:19:17 +13:00
Dean 92cdaf6337 Merge pull request #11624 from Felipebmaitan/feat/windows-guest-gs-state
feat(libkernel): maintain per-thread guest GS bases on Windows
2026-11-05 06:35:52 +13:00
Dean b593093818 Merge pull request #12146 from AlexFigas/feat/libc-shared-mutex
feat(libc): implement the _Smtx shared mutex calls over libkernel's rwlocks
2026-11-04 18:34:09 +13:00
Felipebmaitan 41bbc32070 chore: refresh GS state with current main 2026-11-03 14:34:25 -03:00
JJenkx 4199ddb205 fix(libkernel): refresh adopted thread bounds when entering the main stack 2026-11-03 04:32:26 -05:00
Dean 8835460b5e Merge pull request #7532 from hugodearaujo/fix/linux-guest-main-stack
fix(linux): enter the guest entry on a main stack at the console's address
2026-11-03 21:07:51 +13:00
Dean a03cc0dde6 Merge pull request #14885 from oneandonlydean/carry-7135
fix(libkernel): follow kern_cpuset for the base cpuset, level checks and interrupt targets
2026-11-03 18:14:20 +13:00
Dean Galvin df788026b6 fix(libkernel): refuse cpuset sizes the console rejects and record the EPERM difference
cpuset_getaffinity and cpuset_setaffinity return ERANGE from 24 bytes, as a PS5 payload process did (rooklz sweep, #7135 comment 6391606624: 8 to 16 accepted, below 8 and from 24 up ERANGE), and throw for the unmeasured 17 to 23, as pthread_getaffinity_np does. The tests that used 32 bytes use 16 and pin 7, 24, 32 and 64 to ERANGE. The setter entry records that the console answers EPERM for a CPU outside the process's set where this clips and returns 0.
2026-11-03 15:15:35 +13:00
Dean Galvin cc73f16c59 fix(libkernel): answer CPU_LEVEL_ROOT and test the cpuset sizes the console accepts
cpuset_getaffinity at CPU_LEVEL_ROOT returns 0xffff, as a PS5 payload process read it (rooklz, #7135 comment 6390891591), instead of throwing; the target is checked as at the other levels. The level 2 base-set test now passes 8 and 16 bytes, which the console accepts (it returns ERANGE from 24 bytes), instead of depending on the 32 bytes it rejects. The debt entry records the root measurement and that the title root set is unmeasured.
2026-11-03 15:11:23 +13:00
Dean Galvin 2d8e93e6b4 Merge commit '88bb16c20e757658078b3efce912c96b1b03502a' into HEAD
# Conflicts:
#	core/libs/prx/libkernel_sys/Export.Discovery.cpp
#	core/libs/prx/libkernel_sys/include/Api.hpp
2026-11-03 11:45:12 +13:00
Dean e35691b9a0 Merge pull request #14402 from roboterspinne/fix/libkernel-thread-description-utf8
fix(libkernel): convert guest thread names from UTF-8 for the Windows thread description
2026-11-03 08:49:38 +13:00
Alexandre Figueiredo 7542cc18c8 Merge upstream main into feat/libc-shared-mutex 2026-11-02 19:46:24 +00:00
Dean b0c4915518 Merge pull request #14039 from EagleBearerYS/fix/kernel-getaffinity-console-sizes
fix(libkernel): follow the console's set sizes in pthread_getaffinity_np
2026-11-03 08:45:45 +13:00
Dean b052a9307b Merge pull request #12005 from akkadbakkad89/exception-drain-mailbox
fix(libkernel): post guest raises to the delivery drain mailbox on Windows
2026-11-03 01:29:04 +13:00
Dean eeb3dfea52 Merge pull request #11849 from AlexFigas/fix/libkernel-guest-thread-x87-control-word
fix(libkernel): start guest threads with the x87 control word 0x037f
2026-11-03 01:27:12 +13:00
Dean 947ebf3d2c Merge pull request #10817 from MarcZX10/marc/fix-thread-join-detach-released
fix(libkernel): return ESRCH from join, detach and cancel of a released thread handle
2026-11-02 23:24:36 +13:00
Dean 0ba2a2a124 Merge pull request #10810 from MarcZX10/marc/fix-thread-detached-race
fix(libkernel): read and write the detached state of a guest thread atomically
2026-11-02 23:24:31 +13:00
Dean 4b1076c483 Merge pull request #8477 from ycarogabriel-lgtm/codex/macos-host-fault-signals
fix(libkernel): keep host fault signals available on macOS
2026-11-02 20:56:46 +13:00
Dean 042c5fa5ce Merge pull request #12925 from KernelPanicNT/feat/libkernel-condattr-getclock-null-output
feat(libkernel): throw for a null pthread_condattr_getclock output
2026-11-02 20:55:04 +13:00
Alexandre Figueiredo b9bd78e26d Merge upstream main into feat/libc-shared-mutex 2026-11-01 23:10:45 +00:00
erickerxhalli cdcea60a80 Merge remote-tracking branch 'upstream/main' into feat/libkernel-mutex-prioceiling
# Conflicts:
#	core/libs/prx/libkernel/Pthread/include/Pthread.hpp
#	docs/dev/debt/libkernel.md
2026-11-01 20:07:02 +00:00
Dean GalvinandAlexej Szpevák f82fb8a9c9 fix(libkernel): carry cpuset base-set and level handling
Carry #7135 by @AlexOfTheForest. Preserve current checked guest-memory copies and unrelated debt; remove the ten newly added unsupported-call throw assertions while retaining implemented success and error coverage.

Co-authored-by: Alexej Szpevák <[email protected]>
2026-11-02 08:21:01 +13:00
Ycaro Gabriel adefe80eea chore(merge): sync host fault signals with upstream main
Update the host-fault signal change to current main while preserving the Windows pending-exception delivery path and macOS unblocked fault signals.
2026-11-01 14:10:11 -03:00
roboterspinne fd1ec93315 fix(libkernel): convert guest thread names from UTF-8 for the Windows thread description 2026-11-01 11:40:34 +01:00
Dean Galvin 09690aaa78 Merge commit 'd5ec8e6575be37f4340ded9c64c51b1d07076b51' into HEAD
# Conflicts:
#	core/libs/prx/libkernel/System/src/Process.cpp
#	core/libs/tests/write_watch/CMakeLists.txt
#	docs/dev/debt/libkernel.md
2026-11-01 23:40:31 +13:00
Yunus Shaikh 711f3a69f1 Merge main into fix/kernel-getaffinity-console-sizes
The conflict with #13908 in docs/dev/debt/libkernel.md keeps both sides: this branch's pthread_getaffinity_np entry, followed by #13908's sentence on the EFAULT fallback for a mask pointer that cannot be read or written.
2026-11-01 01:01:07 -08:00
Adrià 6c0bdd2014 Merge pull request #13908 from DeveshB-1/fix/cpuset-affinity-efault
fix(libkernel): return EFAULT from cpuset and pthread affinity for invalid memory
2026-11-01 09:55:39 +01:00
Dean Galvin c4629cbbe0 Merge main into feat/libkernel-condattr-getclock-null-output
# Conflicts:
#	docs/dev/debt/libkernel.md
#	docs/dev/debt/libkernel_sys.md
2026-11-01 21:13:14 +13:00
akkadbakkad89andDevin 7ff3b7091b fix(libkernel): post guest raises to the delivery drain mailbox on Windows
Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-01 13:23:10 +05:30
DeveshB-1 51bd568169 fix(libkernel): return EFAULT from cpuset and pthread affinity for invalid memory 2026-11-01 08:18:41 +01:00
GruzzberryandClaude Sonnet 5.5 5ba892d391 fix(libkernel): fail rtprio_thread, sched_setscheduler and setpriority with the jail privilege errors
A title is jailed (agreed on #11216). FreeBSD 11.4 prison_priv_check denies
PRIV_SCHED_RTPRIO, PRIV_SCHED_SET and PRIV_SCHED_SETPRIORITY to a jailed caller.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-11-01 07:56:25 +01:00
Adrià 97ca8c8751 Merge pull request #13832 from zaryabzip/fix/pthread-cond-signalto-esrch
fix(libkernel): return ESRCH from signalto for a handle that is not a thread
2026-11-01 04:28:11 +01:00
Adrià cac9da41e4 Merge pull request #13725 from cocoa55/fix/cond-relock-spin
fix(libkernel): spin and yield when a condition variable wait relocks its mutex
2026-10-31 22:20:43 +01:00
Yunus Shaikh 6093634622 fix(libkernel): follow the console's set sizes in pthread_getaffinity_np
rooklz measured on a PS5 that pthread_getaffinity_np accepts any set of 8 to
16 bytes, zero-fills it past byte 8, and returns ERANGE below 8 bytes and from
24 up. Sets of 17 to 23 bytes are not measured and still throw.
2026-10-31 15:58:18 +00:00
Adrià e23eea90e2 Merge pull request #13660 from w4rc0n/fix/sched-own-pid-main-thread
fix(libkernel): select the registered main thread for own-pid scheduling
2026-10-31 12:45:48 +01:00
zaryabzip 0a5c3be283 fix(libkernel): return ESRCH from signalto for a handle that is not a thread
scePthreadCondSignalto and pthread_cond_signalto_np answered EPERM for a
handle that is not a live thread, where a PS5 on firmware 13.60 returns
ESRCH. The check sits between the null-thread and not-waiting checks, as
that console orders them.
2026-10-31 13:37:23 +05:00
Felipebmaitan e55062f184 chore: integrate current main into GS state 2026-10-31 00:37:56 -03:00
cocoa55andClaude Opus 5.5 8c4cdf84a2 test(libkernel): count the yields a woken condition variable wait makes
The mutex yield step counts each yield in a counter that
MutexYieldsForTest_nid_no_patch reads. With no spins and a yield count
of 5, a waiter woken while another thread holds its mutex must yield
exactly 5 times before it blocks, for each mutex type and for the outer
level of a recursive mutex held twice. With WakingLock::lock calling
the native lock directly the count stays 0 and the test aborts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 23:37:35 -04:00
cocoa55andClaude Opus 5.5 16375634e3 fix(libkernel): spin and yield when a condition variable wait relocks its mutex
FreeBSD 11.4's _mutex_cv_lock takes the mutex back through
mutex_lock_common, so a woken waiter tries once, spins and yields by
the mutex's counts before it blocks. The wait here called the native
lock directly; it now goes through the same spin and yield path as
scePthreadMutexLock.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 22:47:35 -04:00
infra-rig 5090bcd175 fix(libkernel): select the registered main thread for own-pid scheduling
sched_getparam, sched_getscheduler and sched_setparam with the own pid
from a thread other than the main thread act on the main thread once it
has registered through scePthreadSelf, as FreeBSD's p1003_1b.c selects
the first thread. Before registration, after the main thread exits and
on macOS they still throw.
2026-10-30 16:35:04 -06:00
erickerxhalli 3aa61cb9d4 Merge remote-tracking branch 'upstream/main' into feat/libkernel-mutex-prioceiling
# Conflicts:
#	core/libs/prx/libkernel_sys/Export.Discovery.cpp
#	core/libs/prx/libkernel_sys/include/Api.hpp
2026-10-30 19:41:06 +00:00
cocoa55andClaude Opus 5.5 32abcb15a0 fix(libkernel): try a mutex once before its spin and yield budget
FreeBSD's mutex_lock_common tries the lock before mutex_lock_sleep
spins or yields, so a free mutex with yield loops and no spins was
yielding before its first try here.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 15:30:54 -04:00
cocoa55andClaude Opus 5.5 9a7acb3677 fix(libkernel): spin and yield by the mutex spin and yield loop counts
Lock and timed lock now try the mutex up to the spin count with a pause
between tries, then up to the yield count with a yield before each try,
before they block, as FreeBSD 11.4's mutex_lock_sleep does. Trylock and
a lock the thread already holds do not spin. A uniprocessor host skips
the spins and keeps the yields.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 13:56:31 -04:00
Adrià 96ff704249 Merge pull request #12667 from xdCloudy/feat/libkernel-sys-pthread-attr-helpers
feat(libkernel_sys): implement mutex attribute generation helpers
2026-10-30 14:02:33 +01:00
hugodearaujo 67658c0cbd Merge main into fix/linux-guest-main-stack
# Conflicts:
#	docs/dev/debt/libkernel.md
2026-10-30 09:56:11 -03:00
hugodearaujo 003002a852 Merge main into fix/linux-guest-main-stack
# Conflicts:
#	core/relinker/elfpatcher/src/general/EntryStubBuilder.cpp
2026-10-30 07:13:21 -03:00
DeveshB-1 9e5683dd8b fix(libkernel): return EFAULT from sched_getparam and sched_setparam for invalid memory 2026-10-30 15:05:54 +05:30
Alexandre Figueiredo 950ce5a4fc Merge upstream main into fix/libkernel-guest-thread-x87-control-word 2026-10-30 08:39:26 +00:00
Alexandre Figueiredo 797464dfc2 Merge upstream main into feat/libc-shared-mutex 2026-10-30 08:39:26 +00:00
Cloudy d833429467 feat(libkernel_sys): implement pthread attribute helpers 2026-10-30 08:12:52 +01:00