Commit Graph

601 Commits

Author SHA1 Message Date
Adrià effc61e4cd
Merge pull request #2787 from tototomate123/fix/hfw-filesystem-split
fix(libkernel): return guest chmod errors and implement sceKernelFutimes
2026-10-11 09:19:44 +02:00
Adrià 0c63c83882
Merge pull request #3227 from GustavoGamarra95/perf/unwind-info-procmap-query
perf(libkernel): look up unwind mappings with PROCMAP_QUERY
2026-10-11 09:18:50 +02:00
Adrià 75c979ad9f
Merge pull request #3056 from TheAggie/feat/libkernel-get-app-info
feat(libkernel): implement sceKernelGetAppInfo
2026-10-11 09:12:54 +02:00
Dean d7cfa72813
Merge pull request #3150 from MarcZX100/codex/marc-socket-vector-io
fix(libkernel): route vector I/O on guest sockets
2026-10-11 18:47:36 +13:00
Dean b64cc2ce44
Merge pull request #3053 from MarcZX100/codex/libkernel-rmdir-read-only-3049
fix(libkernel): remove read-only directories with rmdir on Windows
2026-10-11 18:44:11 +13:00
Dean 0cf94023b6
Merge pull request #3047 from babyhuey/feat/libkernel-pthread-kill
feat(libkernel): implement pthread_kill
2026-10-11 18:44:02 +13:00
Dean 90f26c996c
Merge pull request #3031 from TheAggie/feat/libkernel-pthread-set-name-np
feat(libkernel): implement pthread_set_name_np
2026-10-11 18:40:30 +13:00
Gustavo Ariel Gamarra Rojas 15ae919325 perf(libkernel): look up the mapping with PROCMAP_QUERY in sceKernelGetModuleInfoForUnwind
On Linux every call opened /proc/self/maps and scanned it line by line with sscanf. Unity titles call it on each stack walk, and with about 900 mappings God of War Sons of Sparta (PPSA28997) spent most of its main thread there. The covering mapping is now asked of the kernel with PROCMAP_QUERY (Linux 6.11), on one descriptor opened once, as GuestMemory does; older kernels and APS5_NO_PROCMAP_QUERY keep the line scan.
2026-10-10 22:50:46 -03:00
MarcZX100 eb9efe109e fix(libkernel): preserve vector socket error codes 2026-10-11 01:17:37 +00:00
MarcZX100 d78af2c710 fix(libkernel): route vector I/O on guest sockets 2026-10-11 01:16:58 +00:00
Hannah Lyons 0e88f3014d fix(libkernel): name pthread_kill's errors and test the signal range edge 2026-10-10 21:11:29 -04:00
Hannah Lyons d8af71c0ca feat(libkernel): implement pthread_kill 2026-10-10 21:11:29 -04:00
Scott Schuster 3f32c12fd8 fix(libkernel): read sceKernelGetAppInfo's title id through AppMetadata
The title id now comes from GetAppTitleId, so param.json has one parser and
its validation (a missing file or titleId throws). Another pid returns EPERM
and a null info returns 0 without writing, as shadPS4 does. app_id stays 1,
the running title's id in libSceSystemService, which is inferred, not
measured.

guest_app_info runs the call without param.json in a child process and
checks that the field between app_id and the title id is left alone.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 03:11:18 +02:00
Scott Schuster a6520d0c8b feat(libkernel): implement sceKernelGetAppInfo
sceKernelGetAppInfo fills the app id and the title id of the calling
process: app id 1, the running title's id in libSceSystemService, and the
titleId of /app0/sce_sys/param.json at offset 0x10, up to 9 characters and a
terminator. Only those fields are written, since callers declare the
structure with different sizes. Another pid returns ESRCH and a null info
EFAULT.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 03:11:18 +02:00
David 064f5ca825 feat(libkernel): implement pthread_attr_setsolosched_np
The POSIX alias takes (attr, int), returns EINVAL (22) for a null or
uninitialized attribute like the other pthread_attr setters, and
stores the value through scePthreadAttrSetsolosched, returning its
result in errno form. The signature and the stored int follow the SCE
twin in KytyPS5 and sharpemu; PS5PCEM implements the alias the same
way. The value is not applied to scheduling, recorded in TechnicalDebt.

Returnal (PPSA01285 v03.000.005) stops on it after eager binding
(#2872, #1155):

    what(): pthread_attr_setsolosched_np_nid_postfix not implemented

LEGO Horizon Adventures (PPSA14632, #734) and Palworld (PPSA23126,
#2598) import it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-11 02:06:30 +02:00
Adrià e8d6de4ae7
Merge pull request #1091 from kjhq/feat/libkernel-socket-events
feat(libkernel): implement read and write events for guest sockets
2026-10-11 02:02:31 +02:00
kjhq 0abe0b832b feat(libkernel): wake socket read and write events instead of polling
A wait on an equeue that holds socket events now blocks in poll/WSAPoll on
those sockets plus a per-thread loopback wake socket, instead of rechecking
every millisecond. Adding, triggering or deleting an event and closing the
equeue wake the blocked waiters. Closing a socket removes its read and write
events, as on FreeBSD. A read event also reports EV_EOF once the peer has
shut down its sending side.
2026-10-11 01:54:15 +02:00
kjhq 9b7535c6a4 feat(libkernel): implement read and write events for guest sockets
sceKernelAddReadEvent/DeleteReadEvent and sceKernelAddWriteEvent/
DeleteWriteEvent register EVFILT_READ and EVFILT_WRITE events on guest
sockets. The equeue polls the host socket for readiness on each wait
and reports the readable byte count or the send buffer size in data,
with EV_EOF on hang-up or error.
2026-10-11 01:54:04 +02:00
Hussein Kadhim 709c12e133 fix(libkernel): return EPERM or EINVAL when a condition wait gets a mutex the caller does not hold
pthread_cond_wait and pthread_cond_timedwait, and their sce counterparts, threw a
host exception when the mutex was unlocked, locked by another thread, or not yet
initialized, and dereferenced the adaptive static initializer. FreeBSD returns
EPERM for these (EINVAL for a destroyed mutex) before touching the condition.

(cherry picked from commit a78bb8a855ca3b277f128c6a9e52ff3949b9cb80)
2026-10-11 01:53:12 +02:00
Adrià 62419286cd
Merge pull request #3009 from MarcZX100/fix/libkernel-open-directory-3004
fix(libkernel): report ENOTDIR for Windows O_DIRECTORY opens
2026-10-11 01:48:46 +02:00
Adrià 5bd6912b0b
Merge pull request #2978 from MarcZX100/fix/libkernel-rwlock-destroy-busy
fix(libkernel): return EBUSY when destroying a held rwlock
2026-10-11 01:45:28 +02:00
Adrià 6dcfc5b646
Merge pull request #2765 from TheAggie/feat/libc-alarm
feat(libc): implement alarm
2026-10-11 01:40:26 +02:00
Zayd Zaari 718eb9cc3e fix(libkernel): return EBUSY when destroying locked rwlock 2026-10-11 01:37:26 +02:00
Adrià df52ac8354
Merge pull request #2898 from MarcZX100/fix/libkernel-windows-lstat-reparse
fix(libkernel): detect Windows reparse points in lstat
2026-10-11 01:13:25 +02:00
Scott Schuster e5ae8dfcb0 fix(libkernel): keep the alarm state alive until the process exits
The detached alarm thread waits on a condition variable that was a
namespace-scope static. At exit its destructor ran with the thread still
waiting, and glibc's pthread_cond_destroy blocks then, so a process that
called alarm never exited on Linux. The mutex, condition variable, deadline
and started flag now live in one structure allocated once and never
destroyed.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 18:04:35 -05:00
Scott Schuster 383bffd8c7 feat(libc): implement alarm
RetroArch (PPSA99169) stops at alarm on main: `FAIL: unresolved ELF import DQXJraCc1rA from libSceLibcInternal.prx`.

alarm(seconds) arms one process-wide real-time alarm and returns the seconds left on the previous one, rounded up like FreeBSD's alarm.c (any partial second counts); alarm(0) cancels it. When it expires, SIGALRM's disposition as recorded by sigaction or signal applies: ignored, nothing happens; default, the process terminates as on FreeBSD (exit status 128 + 14); a guest handler throws, because asynchronous delivery to a guest handler is not implemented.

The timer lives in libkernel next to the signal dispositions (GuestAlarm_nid_no_patch); libSceLibcInternal, which the titles import alarm from, forwards to it.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 17:59:58 -05:00
Adrià 73e5078c3b
Merge pull request #2819 from MarcZX100/codex/mkdir-trailing-slash-2743
fix(libkernel): accept trailing slashes in sceKernelMkdir
2026-10-11 00:52:01 +02:00
Adrià 7250918fea
Merge pull request #2827 from Get-fix/fix/libkernel-execvp
fix(libkernel): export execvp
2026-10-11 00:49:40 +02:00
raghav314 be1f501525 fix(agc): import GPU-mapped guest memory when it is mapped
The registry calls an observer on the mapping thread, after the registry
lock is released, with the ranges a kernel mapping gave GPU access:
direct and flexible maps with it, and fixed remaps with it over a
registered range (a reservation). The mutation looks them up while it
still holds the lock and hands them over weakly, with the registry
generation it ended at, so the observer does not keep a range alive.
The driver imports those ranges on its current device, so an
address-based build finds the import instead of pinning the memory on
the queue that first uses it. A range that gains GPU access through
sceKernelMprotect, and AnyPS5's own libc heap, are still imported on
first use.

The import at map does not reconcile the other imports with the
registry, so its cost does not grow with the number of imports. It skips
a range that is gone, and any range when the imports were reconciled
with a newer registry since; the next lookup imports those as before.
It installs the pin waiter as the other import paths do, so unmapping a
range imported at map retires its import. The live import bytes are kept as a
running total instead of being summed over every import. Once the import
table belongs to the current device the import takes only the table's
lock; the first import on a device (which runs the write-watch probe)
and a device that was just replaced go through the GPU lock. Clearing
the observer waits for calls already running.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 00:23:23 +02:00
Adrià a3c43ad20f
Merge pull request #1739 from Sanjaysrinivas/test/pthread-cancel-recovery
test(libkernel): cover cancellation recovery for #1668
2026-10-11 00:20:59 +02:00
Adrià 5da6096c2a
Merge pull request #3104 from babyhuey/feat/libkernel-sync
feat(libkernel): implement sync
2026-10-11 00:20:28 +02:00
Hannah Lyons 97e81c4224 feat(libkernel): implement sync 2026-10-10 18:12:21 -04:00
David 9902f137af feat(libkernel): implement sceKernelFcntl
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
(cherry picked from commit f0c649704dbf0b84077c29ea914e0e4799714fe1)
2026-10-11 00:06:02 +02:00
Adrià dc105f8abf
Merge pull request #2973 from babyhuey/feat/libkernel-rwlockattr
feat(libkernel): implement pthread_rwlockattr_init and pthread_rwlockattr_destroy
2026-10-10 23:53:36 +02:00
Adrià c051e83c4e
Merge pull request #3005 from babyhuey/feat/libkernel-preadv
feat(libkernel): implement preadv and pwritev
2026-10-10 23:52:58 +02:00
David b69fba6a15 fix(libkernel): remove read-only directories with rmdir on Windows
(cherry picked from commit da6889627a417df433802a45a8fcca58a6cb904f)
2026-10-10 21:14:34 +00:00
Scott Schuster ce98a61a83 feat(libkernel): implement pthread_set_name_np
pthread_set_name_np renames through scePthreadRename; a null name clears it,
as in FreeBSD.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 15:41:36 -05:00
David ee0b249e4e fix(libkernel): report ENOTDIR from open with O_DIRECTORY on a file on Windows
(cherry picked from commit b2e9f59959f3eef10db3f68886ee9d9ec1d50ea4)
2026-10-10 20:31:35 +00:00
Dean 262c031692
Merge pull request #2907 from oneandonlydean/carry/libkernel-reserved-range-hint
fix(libkernel): map non-fixed hints inside a reserved range in place
2026-10-11 09:26:41 +13:00
Hannah Lyons 0c2d85238b feat(libkernel): implement preadv and pwritev 2026-10-10 16:21:56 -04:00
MarcZX100 7f2a88262a fix(libkernel): detect Windows reparse points in lstat 2026-10-10 20:09:49 +00:00
Dean 6c008c180e
Merge pull request #2935 from AchrafReyani/feat/libkernel-siglongjmp
feat(libkernel): implement siglongjmp
2026-10-11 09:09:18 +13:00
Dean 0ed05471e5
Merge pull request #2899 from MarcZX100/codex/mutexattr-prioceiling-2689
feat(libkernel): implement mutex priority ceiling attributes
2026-10-11 09:02:05 +13:00
Dean 97d347cf33
Merge pull request #2897 from LeandroLP23/feat/libkernel-pthread-sigmask
feat(libkernel): implement pthread_sigmask
2026-10-11 09:01:55 +13:00
Dean a8d24c7e44
Merge pull request #2910 from AchrafReyani/fix/unlink-readonly
fix(libkernel): unlink read-only files on Windows
2026-10-11 08:58:25 +13:00
Dean 8559ba7de1
Merge pull request #2758 from TheAggie/fix/libkernel-reserve-virtual-hint
fix(libkernel): place sceKernelReserveVirtualRange at its address hint
2026-10-11 08:41:52 +13:00
Sanjaysrinivas 982f7d7817 test(libkernel): cover cancellation recovery
Refs #1668. Complements #1141 with resource ownership and lifecycle regressions.
2026-10-10 21:27:49 +02:00
Hannah Lyons 5a43c9b0b9 feat(libkernel): implement pthread_rwlockattr_init and pthread_rwlockattr_destroy 2026-10-10 15:07:43 -04:00
Dean 7159f7f345
Merge pull request #2859 from babyhuey/feat/libkernel-cpuset-getaffinity
feat(libkernel): implement cpuset_getaffinity for the calling thread
2026-10-11 07:27:05 +13:00
Dean b78ced2b1e
Merge pull request #2858 from babyhuey/feat/libkernel-fstatfs
feat(libkernel): implement _fstatfs
2026-10-11 07:26:56 +13:00