Commit Graph

439 Commits

Author SHA1 Message Date
Joey Fisher f2d201fbbf fix(ajm, apr): keep AJM and APR state alive through static teardown
AJM's instance and batch tables and APR's file, directory and AMM
state were namespace-scope statics, destroyed by std::exit while the
title's threads keep calling the libraries. A decoder thread then read
a freed instance (an unknown codec), sceAjmBatchWait no longer found
its batch, and APR resolved file ids through a freed vector. The state
is now allocated once and never destroyed.
2026-10-09 20:14:04 -06:00
Dean c963432db0
Merge pull request #1645 from XairRrR/fix/raise-open-file-limit
fix(libkernel): raise the open file soft limit on Linux
2026-10-10 14:44:55 +13:00
Adrià 67bb99865a
Merge pull request #1518 from ArjenS-LA/fix/windows-file-timestamps
fix(libkernel): preserve Windows file timestamp precision
2026-10-10 03:15:32 +02:00
Adrià 426fe62282
Merge pull request #2028 from overlordxrz-source/feat/libkernel-get-module-list
feat(libkernel): implement sceKernelGetModuleList and sceKernelGetModuleInfo
2026-10-10 03:15:01 +02:00
Adrià 6637eee34d
Merge pull request #1600 from awake-devel/fix/libkernel-unwind-info-linux
fix(libkernel): report guest unwind tables in sceKernelGetModuleInfoForUnwind on Linux
2026-10-10 03:13:40 +02:00
Dean 8542c7323c
Merge pull request #1501 from TideOPL/fix/kernel-process-time-start
fix(libkernel): read the process start before the clock in process time
2026-10-10 14:10:57 +13:00
Adrià b8cf0eb24f
Merge pull request #1520 from popcoder565/fix/kernel-nested-sleep-timer
fix(libkernel): give a sleep nested in an APC its own timer on Windows
2026-10-10 03:07:46 +02:00
Adrià Franch 78d92881b0 fix(libkernel): throw when the Linux guest unwind lookup fails
As requested in review: a failed sceKernelGetModuleInfoFromAddr no longer
reports an empty answer. Adds a failure test (symbol interposition) and
extends the metadata test (EH record walk, terminator, no-header DSO).

Co-authored-by: jweidenh <38249793+jweidenh@users.noreply.github.com>
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-10 02:10:08 +02:00
clem-gb 1bd1923718 fix(libkernel): report guest unwind tables in sceKernelGetModuleInfoForUnwind on Linux
A title that ships its own libc.prx unwinds C++ exceptions with that
libc's libunwind, which asks sceKernelGetModuleInfoForUnwind where each
frame's eh_frame is. On Linux the call always reported no tables, so
no C++ exception thrown in guest code could be caught. For the main
executable and .guest.prx images, report the PT_GNU_EH_FRAME tables
that sceKernelGetModuleInfoFromAddr finds, as Windows does from
.ehmeta. Other host images still report none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HeC9bA3n74TzJRYv9AgBE8
2026-10-10 02:09:56 +02:00
ArjenS-LA 705e49d407 fix(libkernel): preserve Windows file timestamp precision 2026-10-10 01:51:56 +02:00
overlordxrz-source 8a41d280af feat(libkernel): implement sceKernelGetModuleInfo
Fill takes either info struct, so sceKernelGetModuleInfo reports the
name and segments sceKernelGetModuleInfoFromAddr reports for the same
image, on Linux and Windows.
2026-10-09 19:39:49 -04:00
overlordxrz-source 6d42f3a910 feat(libkernel): implement sceKernelGetModuleList 2026-10-09 19:39:49 -04:00
Adrià a291ae0f88
Merge pull request #1483 from Aryansh1520/fix/libkernel-mutex-destroy-busy
fix(libkernel): return EBUSY when destroying a locked mutex
2026-10-10 01:32:32 +02:00
Adrià b02ea5f5ea
Merge pull request #1309 from TibixDev/pr/tracked-backing-writes
perf(memory): write tracked direct memory through backing views
2026-10-10 01:29:11 +02:00
Adrià ff8961dfbc
Merge pull request #1102 from jeffrey12cali/fix/module-args-on-linux
fix(libkernel): pass module args and argp to runtime-loaded modules on Linux
2026-10-10 01:27:59 +02:00
Adrià bb1a726e6e
Merge pull request #1466 from LeandroLP23/fix/kernel-download0-at-start
fix(kernel): create /download0 at start-up when the title declares download data
2026-10-10 01:27:57 +02:00
Adrià 76bff21fbe
Merge pull request #1421 from popcoder565/fix/kernel-raise-exception-ntcontinue
fix(libkernel): stop losing and deadlocking sceKernelRaiseException deliveries on Windows
2026-10-10 01:23:17 +02:00
Adrià c5424ab69c
Merge pull request #1916 from johnmaia/feat/libkernel-sigaction
feat(libkernel): implement sigaction
2026-10-10 01:20:54 +02:00
Adrià 624b2b7eff
Merge pull request #1135 from orbz22/fix/kernel-aio-keep-offset-windows
fix(kernel): keep the file offset in Windows AIO reads and writes
2026-10-10 01:09:52 +02:00
jeffrey12cali 36c979b369 fix(libkernel): pass module args and argp to runtime-loaded modules on Linux
sceKernelLoadStartModule discarded its arguments, and the relinker's Linux guest writer
synthesized an initialisation trampoline that also cleared the argument registers before
jumping to the module entry point, so a converted module always reached its own start-up
code with args = 0 and argp = NULL.

On PPSA28997 two of the title's own modules validate that parameter block as their first
act and dereference it unconditionally: SaveData faults on `mov (%rsi),%eax` with rsi = 0
beside its `cmp $0x10` size checks, and PSN faults the same way at PSN+0x3ee7 with rbx = 0.
The Windows branch delivers the block, so identical code reports its parameter-version
error and continues instead of faulting.

sceKernelLoadStartModule now records the pair before dlopen and clears it afterwards, and
the emitted DT_INIT stub reads it through two accessors exported by libkernel. The
initialiser is called rather than tail-jumped so its return value can be reported through
*res as the PS5 API specifies. The state is thread_local, which makes the handoff per-call:
ld.so runs a module's initialiser on the thread that called dlopen. DT_FINI keeps a plain
call-through, so unloading neither reads stale arguments nor reports a result.

The accessor names use the _nid_no_patch suffix so the NID resolver leaves them alone and a
guest import can name them exactly.
2026-10-10 00:57:51 +02:00
Adrià Franch 0e32f3662b fix(memory): throw when the direct memory write view cannot be mapped 2026-10-10 00:53:38 +02:00
TibixDev e7f4b1a1fd perf(memory): write tracked direct memory through backing views
Retain host backing views for emulator writes and completion labels. Validate full spans, preserve write versions and GPU ordering, and keep the fallback for other mappings. Test remaps, aliases, access checks, partial failures, tracking, view lifetime, and completion ordering.

Written with AI assistance.
2026-10-10 00:53:29 +02:00
john.maia e462d0602a refactor(libkernel): size the delivered signal handler table like the dispositions
Assisted by Claude Code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DwFnKjMxmwGDWiuYYf1v4D
2026-10-09 23:42:43 +01:00
john.maia cfe4a277c4 feat(libkernel): implement sigaction
EVO-PLAYER (PPSA99039) v0.11.0 stops at sigaction once its earlier
imports resolve: it installs a crash handler for SIGSEGV, SIGBUS and
SIGABRT and a quit handler for SIGTERM, SIGINT and SIGHUP at start-up.

sigaction records the handler, flags and mask of signals 1 to 128 and
reports them back, with FreeBSD's EINVAL cases. signal shares the table
and records SA_RESTART, as FreeBSD's libc does. Plain handlers on the
signals signal already delivers run as signal handlers do; SA_SIGINFO
handlers and other signals are recorded only, and raise of such a
signal throws.

Assisted by Claude Code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DwFnKjMxmwGDWiuYYf1v4D
2026-10-09 23:42:43 +01:00
Adrià 09a3462eca
Merge pull request #1192 from ps54all/feat/libkernel-posix-rename
feat(libkernel): export the POSIX rename
2026-10-10 00:34:32 +02:00
Raihan Abdul Majid e768d97949 fix(kernel): keep the file offset in Windows AIO reads and writes
Each Windows AIO request is an overlapped ReadFile/WriteFile at the
request's offset, which on a synchronous handle also moves the
descriptor's file pointer; on the console AIO transfers leave it alone.
The requests now go through the positioned path sceKernelPread and
sceKernelPwrite use (NativePositioned in Stdio.cpp, exposed as
NativePositioned_nid_no_patch), which restores the pointer afterwards.
Negative offsets still fail with EINVAL before the transfer.

GuestAio sets the offset to 2 before a write batch and checks it is
still 2 after. TechnicalDebt records that a concurrent read or write on
the same descriptor can see the moved pointer in between, as for the
pread family.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UTjpbMX7BUFMZZaxJE98zV
2026-10-10 00:22:22 +02:00
Adrià fa899a3468
Merge pull request #1857 from hikazey/feat/msync
feat(libkernel): implement msync
2026-10-10 00:12:20 +02:00
popcoder565 5dc7021c38 Merge remote-tracking branch 'origin/main' into fix/kernel-raise-exception-ntcontinue
Keeps both new TechnicalDebt entries: this branch's note that a raise
can still reenter host code it interrupted, and #2107's sigaltstack note.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 18:07:20 -04:00
Adrià c2ac5dd93f
Merge pull request #1676 from Recapi/feat/libkernel-thread-cpu-clock
feat(libkernel): implement pthread_getcpuclockid and per-thread CPU clocks
2026-10-10 00:01:18 +02:00
Adrià 6642559456
Merge pull request #1675 from Recapi/feat/libkernel-getrlimit
feat(libkernel): implement getrlimit for RLIMIT_DATA
2026-10-10 00:00:57 +02:00
Adrià 416e40ef29
Merge pull request #2118 from rozbh/feat/libkernel-aio-poll-requests
feat(libkernel): implement sceKernelAioPollRequests
2026-10-09 23:59:29 +02:00
Adrià 7331a123e9
Merge pull request #2107 from LeandroLP23/feat/libkernel-sigaltstack
feat(libkernel): implement sigaltstack
2026-10-09 23:56:02 +02:00
Adrià db06355f84
Merge pull request #1859 from overlordxrz-source/feat/libkernel-system
feat(libkernel): implement system
2026-10-09 23:55:09 +02:00
Adrià 8d47cfba88
Merge pull request #1807 from SleglJan/feat/libkernel-sandbox-random-word
feat(libkernel): implement sceKernelGetFsSandboxRandomWord
2026-10-09 23:52:40 +02:00
Adrià 72cf6c3c5a
Merge pull request #1624 from babyhuey/feat/libkernel-lstat
feat(libkernel): implement lstat
2026-10-09 23:52:02 +02:00
Adrià 2dbc137693
Merge pull request #1798 from hugodearaujo/feat/libkernel-pthread-getname-np
feat(libkernel): implement pthread_getname_np
2026-10-09 23:51:56 +02:00
Adrià 830130aa00
Merge pull request #1620 from babyhuey/feat/libkernel-fdatasync
feat(libkernel): implement fdatasync
2026-10-09 23:50:45 +02:00
Adrià 3d19932caf
Merge pull request #1738 from SleglJan/feat/libkernel-termios
feat(libkernel): implement tcgetattr and tcsetattr
2026-10-09 23:48:53 +02:00
Dean 80cc71419b
Merge pull request #1355 from MarcZX100/test/register-pthread-start
test(libkernel): register and bound pthread start test
2026-10-10 10:45:00 +13:00
hikazey 0bff6da3d3 feat(libkernel): implement msync
msync follows FreeBSD 11's kern_msync and vm_map_sync over the guest's
mappings as sceKernelVirtualQuery reports them: the address is rounded
down to the page, a range that wraps and MS_ASYNC with MS_INVALIDATE are
EINVAL, an unmapped start or page is ENOMEM, and length 0 checks the
mapping that holds the address. The guest has no file mappings, so a
successful call has nothing to write back. MS_INVALIDATE on a mapped
range throws, since FreeBSD's EBUSY for mlocked pages needs lock state
that is not tracked.

EVO-PLAYER PPSA99039 v0.11.0 imports it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 23:38:58 +02:00
Adrià e603f3f560
Merge pull request #1613 from NumberGuan/codex/posix-temp-files
feat(posix): implement mkstemp and isatty
2026-10-09 23:37:02 +02:00
Hannah Lyons 903f50a3b4 feat(libkernel): implement lstat 2026-10-09 17:30:43 -04:00
Hannah Lyons 6768210713 feat(libkernel): implement fdatasync 2026-10-09 17:30:24 -04:00
Adrià d724cad38c
Merge pull request #1748 from danielradosa/feat/libkernel-seteuid-setegid
feat(libkernel): implement seteuid and setegid
2026-10-09 23:23:34 +02:00
Adrià 5bc7886ab8
Merge pull request #1188 from MathiasDevelopes/feat/kernel-module-info-windows
feat(libkernel): implement sceKernelGetModuleInfoFromAddr on Windows
2026-10-09 23:22:46 +02:00
Adrià 870ac041c5
Merge pull request #1685 from overlordxrz-source/feat/libkernel-sysctl-hw-ncpu
feat(libkernel): implement sysctl and sysctlbyname for hw.ncpu
2026-10-09 23:20:13 +02:00
NumberGuan f9be27619e fix(posix): preserve the socket helper during NID patching 2026-10-09 23:19:03 +02:00
Adrià 2e375a5c84
Merge pull request #1634 from babyhuey/feat/libkernel-getdents
feat(libkernel): implement getdents and getdirentries
2026-10-09 23:18:45 +02:00
Jan Šlégl 14cc6497d2 feat(libkernel): implement tcgetattr and tcsetattr
A title's descriptors are taken as never being terminals: a file or
pipe gets ENOTTY with the termios untouched, a socket gets what its
protocol answers a termios ioctl on FreeBSD (EADDRNOTAVAIL for AF_INET,
EOPNOTSUPP otherwise), and a closed or invalid descriptor EBADF.
tcsetattr gives EINVAL for an action other than TCSANOW, TCSADRAIN or
TCSAFLUSH, with or without TCSASOFT, before anything else, and EFAULT
for a null termios before the descriptor is checked; with TCSASOFT a
null termios throws, where FreeBSD's libc faults copying it. What the
console gives a title as descriptors 0 to 2 is unknown, as recorded in
TechnicalDebt.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-09 23:17:12 +02:00
LeandroLP23 c54143dbb9 feat(libkernel): implement sigaltstack
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 23:16:18 +02:00