Commit Graph
14017 Commits
Author SHA1 Message Date
Dean d1f8ae2147 Merge pull request #8211 from ycbuzi/pr/libc-rint-rounding-mode
fix(libc): honour the rounding mode in rint and rintf
2026-10-21 01:37:57 +13:00
Maz 3810389c94 fix(libc): preserve zero in alternate wide octal formatting 2026-10-20 16:36:32 +04:00
xXPBSXxandClaude Sonnet 5.5 12785e2192 fix(libkernel): accept MAP_ANON without MAP_PRIVATE and refuse MAP_SHARED with MAP_PRIVATE
FreeBSD 11.4 kern_mmap maps anonymous memory whenever MAP_ANON is set, with
or without MAP_PRIVATE (sys/vm/vm_mmap.c:339), and fails with EINVAL when
both MAP_SHARED and MAP_PRIVATE are set (vm_mmap.c:252). The guest failed
the first with ENOTSUP (45) and the second with ENOTSUP as well.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 14:35:04 +02:00
milescovielloandClaude Opus 5.5 850b807cf2 fix(libSceNgs2): let rack locks and renders exclude each other across systems
Rack locks and renders were tracked per system, so a voice callback
that locked a rack of another system could deadlock with that system's
render, or with a thread holding rack locks in both systems. Rack locks
and renders now exclude each other across threads and systems, as the
single internal lock did, while a thread nests them and other calls go
ahead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-20 12:33:33 +00:00
hypermistandClaude Opus 5.5 fa0e7b8c13 feat(libkernel): implement pthread_cleanup_push and pthread_cleanup_pop
The exported forms allocate the handler record themselves and free it
when it is popped, as libkernel does; __pthread_cleanup_pop_imp now frees
such records too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK
2026-10-21 01:33:25 +13:00
Dean 88942aa99d Merge pull request #8280 from thuanquang/fix/mul-lo-u16-keep-24-bit-factors
fix(shader): keep the 24-bit factor reads of 16-bit multiplies
2026-10-21 01:30:18 +13:00
hypermistandClaude Opus 5.5 e9bde2a2d4 feat(libSceVideoOut): implement sceVideoOutRemoveBufferAttributeOption
Clear the given bits of the attribute's option field, the inverse of
sceVideoOutAddBufferAttributeOption, as libSceVideoOut does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK
2026-10-21 01:28:22 +13:00
Savvanis Spyros 079e6ca316 Merge remote-tracking branch 'origin/main' into fix/windows-runtime-module-start 2026-10-20 15:27:06 +03:00
Savvanis SpyrosandClaude Opus 5.5 2e1864cdf4 fix(relinker): keep starting standard module folders on Windows
The browser converter treats sce_module as a runtime directory, so the
Windows deferral of runtime modules the executable needs also deferred
libc.prx and libSceFios2.prx, which titles never load themselves.
Modules in sce_module, sce_modules and prx that the executable needs
are started at startup again, as the Linux deferral of #6586 keeps
them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-20 15:27:06 +03:00
Savvanis SpyrosandClaude Opus 5.5 fb050223dd fix(relinker): keep padding to the range end and check what the function still covers
Check padding up to the end of the inspected range first, as before, and
use the 16-byte boundary rule only when that fails, so a long NOP that
crosses the boundary no longer rejects the table. Check the bytes the
function's own unwind range still covers after the table, so a table cut
short inside its function is rejected again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-20 15:26:15 +03:00
Dean 02b5a8e55f Merge pull request #8028 from ymatrix1/feat/hmd2-missing-exports
feat(libSceHmd2): export missing firmware HMD2 interfaces
2026-10-21 01:24:37 +13:00
akkadbakkad89andDevin 9fc0c88550 fix(libScePsml): copy MFSR object fields under the lock and drop the dump title id
Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-10-20 17:54:26 +05:30
Dean aa02422869 Merge pull request #7954 from mazen320/fix/pass-input-hazard-when-copied
fix(agc): require the pass-input barrier only for an in-place read
2026-10-21 01:24:17 +13:00
hamb3r 2693c44569 docs(libc): document Windows backtrace stop at PE unwind handlers 2026-10-20 15:22:50 +03:00
xXPBSXxandClaude Sonnet 5.5 0a0910c54d test(libkernel): expect ENOENT for a missing rename source with a NULL destination
The rename source is now resolved before the destination argument, as in
FreeBSD kern_renameat, so sceKernelRename("src", nullptr) fails with ENOENT
when src does not exist. GuestPosixScalarIo still expected EFAULT.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 14:22:35 +02:00
xXPBSXxandClaude Sonnet 5.5 78c79de242 fix(libkernel): let raise(0) check the calling thread and return 0
FreeBSD 11.4 raise is thr_kill(thr_self(), sig) (lib/libc/gen/raise.c:52),
and thr_kill with a thread id treats signal 0 as a pure existence check
that returns 0 (sys/kern/kern_thr.c:425). The guest returned EINVAL.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 14:22:18 +02:00
Savvanis SpyrosandClaude Opus 5.5 f154e132bc fix(relinker): take pointers into data between PS4 unwind functions as data
The code analysis of the Windows and macOS outputs followed every
relocation and lea target inside the code range as code. PS4 images keep
read-only data between unwind functions, and strings and tables there
decoded into garbage, failing the conversion. Outside the unwind functions
such a target is now code only when it is 16-byte aligned, starts less
than 256 bytes after an unwind function and decodes to a jump, return or
trap; lea targets go through the same rule instead of the graph's own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-20 15:19:45 +03:00
Savvanis SpyrosandClaude Opus 5.5 e0230e6a75 fix(relinker): skip syscall bytes without a syscall number between PS4 unwind functions
Between the unwind functions of a PS4 image the bytes are not known to be
code, and read-only tables there can hold 0f 05. Outside the unwind
functions a syscall, sysenter, int 0x80 or sysret pattern now fails the
relink only when a constant syscall number is loaded right before it; the
others are skipped and counted in one message. Inside the unwind functions
and in other images every such instruction still fails.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-20 15:19:45 +03:00
Savvanis SpyrosandClaude Opus 5.5 dc642205a5 docs(libSceNpManager): list sceNpUnregisterPlusEventCallback under Silent stubs
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-20 15:19:42 +03:00
Mehran 5bb72c6b12 perf(shader): validate vertex stage inputs without building them 2026-10-20 15:18:49 +03:00
xXPBSXxandClaude Sonnet 5.5 34acda3429 test(libc): cover rename through a file and through a symbolic link loop
Rename of file/. fails with ENOTDIR and of loop/. with ELOOP on Linux, where
status() of the parent reports the error instead of "not found"; the test also
runs the file case on Windows, where it passes with and without the change.
The loop case needs a symbolic link and runs on Linux only.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 14:16:54 +02:00
xXPBSXxandClaude Sonnet 5.5 529c1a0f51 fix(libkernel): reject undefined sa_flags in sigaction with EINVAL
FreeBSD 11.4 kern_sigaction fails with EINVAL when a handler other than
SIG_DFL and SIG_IGN comes with flags outside SA_ONSTACK, SA_RESTART,
SA_RESETHAND, SA_NOCLDSTOP, SA_NODEFER, SA_NOCLDWAIT and SA_SIGINFO
(sys/kern/kern_sig.c:691-695). The guest accepted any flag word.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 14:16:18 +02:00
al3w0f205 8ea3b5cab5 fix(libSceJpegDec): reject misaligned output buffers and oversized alpha values 2026-10-20 07:12:43 -05:00
Sam ab8cb4f9ad feat(libc): export wcstombs_s
libc.prx did not export wcstombs_s (sZLrjx-yEx4); only libSceAmpr did.
Ghost of Yotei imports it from libc.prx and stops at symbol resolution.

Move the implementation to libc next to wcsrtombs_s. libSceAmpr keeps
its export through an explicit-NID wrapper, because the NID patcher
leaves symbols that libc exports unrenamed in other libraries.
2026-10-20 14:12:11 +02:00
xXPBSXxandClaude Sonnet 5.5 1da2c0ff58 fix(libc): report a status error of the rename parent directory instead of classifying it
RenameDotError looked at the parent of a dot component with exists() and
is_directory(), so a stat failure other than a missing path, such as
permission denied, answered ENOENT or ENOTDIR. The parent is now read with
status(): a missing path is ENOENT (ENOTDIR when a component is a file), any
other error is mapped through FilesystemError, and only a successful status
decides between a directory (EINVAL) and a non-directory (ENOTDIR).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 14:09:41 +02:00
Dean 56b299c3a9 Merge pull request #8347 from orezraey/fix/shader-cache-test-ninja-encoding
test(recompiler): read the cache fixture's build.ninja in the Ninja build-file encoding
2026-10-21 01:05:46 +13:00
Dean 390ec58e20 Merge pull request #8342 from orezraey/fix/hw-oracle-cmd-unicode-python
test(tools): run the hw-oracle oracle.cmd fixture from non-ASCII paths
2026-10-21 01:05:32 +13:00
xXPBSXxandClaude Sonnet 5.5 25a8636b50 fix(libkernel): never block SIGKILL and SIGSTOP in sigprocmask and sigsuspend
FreeBSD 11.4 kern_sigprocmask applies SIG_CANTMASK to the set for SIG_BLOCK
and SIG_SETMASK (sys/kern/kern_sig.c:1056, 1067), and sigsuspend sets its
mask through the same call (kern_sig.c:1534). The guest mask kept both bits,
so sigprocmask(SIG_BLOCK, {SIGKILL}) read back as blocked.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 14:04:06 +02:00
Dean 2d430a877d Merge pull request #8274 from thuanquang/test/subvector-loop-begin-one-compare
test(shader): check that s_subvector_loop_begin tests an empty exec mask with one compare
2026-10-21 01:04:00 +13:00
SamandClaude Opus 5.5 928a11bf2a fix(libkernel): keep the Windows APR read staging buffer off the stack
Windows APR reads are staged through a 64 KiB std::array on the stack of
the thread that submits them (f7953ecac). Titles submit reads from fibers
whose stacks they allocate themselves, which can be smaller than that and
have no guard page, so the array runs past the bottom of the fiber stack
and the file data lands on whatever lies below it. Demon's Souls
(PPSA01341) then crashes in scePthreadMutexLock about half a second after
start, on a mutex that holds bytes of playgo-chunkdefs.xml.

The staging buffer is now allocated for each read, at most 64 KiB. The
new guest_apr_read_stack test reads on a thread with a 64 KiB stack; with
the stack array it ends in a stack overflow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-20 13:03:55 +01:00
Dean 3dc9b794e8 Merge pull request #8292 from hypermoist/feat/libc-stdio-v-scanf-wide-print
feat(libc): implement vfscanf, vscanf, scanf, the wide stream printf family and vswscanf
2026-10-21 01:03:45 +13:00
Adrià a9c93a05cc Merge pull request #8390 from adriadam10/fix/main-raise-exception-budget
fix(main): shrink guest_raise_exception to fit 30 s on Windows
2026-10-20 14:02:17 +02:00
Adrià FranchandClaude Sonnet 5.5 cd2fd50f0c fix(main): halve guest_raise_exception rounds to fit the 30 s budget on Windows
#7652 made raises wait for host code to leave, adding ~3 s to a test that
already took ~16 s on a fast machine. Main run 39414828108 timed out at 30 s
on windows. Round counts halved; every scenario still runs.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 14:02:05 +02:00
Maz 18da29b898 fix(shader): keep recompiler diagnostics off guest stdio 2026-10-20 16:01:02 +04:00
Swetabh Singh dbd849d3c1 feat(libc): implement significand 2026-10-20 17:25:00 +05:30
Swetabh Singh b67e2a3f2f feat(libc): implement sceLibcPafMspacePosixMemalign 2026-10-20 17:22:52 +05:30
hamb3r 28d0b1664b fix(libc): address Windows backtrace review feedback 2026-10-20 14:49:54 +03:00
hypermistandClaude Opus 5.5 b455c751bb fix(libc): leave errno alone for subnormal strtod results
The console's strtof, strtod and strtold set ERANGE only when a
conversion underflows to zero; a non-zero subnormal result leaves errno
unchanged, while the host's sets it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK
2026-10-21 00:48:05 +13:00
ionut27001andClaude Opus 5.5 dfa96f1fe6 fix(libkernel): return ENOENT for thirteen sysctl names, as measured on a PS5
In a payload process on a PS5 (firmware 12.70), sysctlbyname returns -1
with ENOENT for thirteen names that threw here, and leaves the buffer and
the length alone, for a read, a size query, a null length and a null
buffer with a null length. sysctl does the same for the fixed MIBs of
seven of them. sysctlnametomib gives those seven MIBs and returns ENOENT
for hw.cacheline_size and hw.usermem, which threw too.

machdep.cacheline_size already returned ENOENT and is now tested with
the others. A write to the new names and MIBs throws, as the console's
answer to a write was not tried. The hw.realmem and vm.overcommit debt
entries now say that a payload process gets ENOENT for them as well.

AI-assisted: yes

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-20 13:46:29 +02:00
Queuze bbcce1736e fix(libkernel): support socket fcntl duplication 2026-10-20 13:40:22 +02:00
xXPBSXxandClaude Sonnet 5.5 06ee881eba fix(libkernel): look up the descriptor of lseek before the whence value
lseek on a descriptor that is not open with an invalid whence answered EINVAL.
FreeBSD 11.4 kern_lseek looks the descriptor up first and only then lets the
file's seek operation judge the whence, so the answer is EBADF.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 13:39:50 +02:00
Yossi Yadgar 0371d1778e docs(debt): note the rules the Ult lock and ulthread calls assume 2026-10-20 14:35:49 +03:00
Yossi Yadgar 80d00b3f15 feat(libSceUlt): implement sceUltUlthreadGetSelf, sceUltUlthreadYield and sceUltUlthreadExit
An ulthread runs on its own guest thread, so it remembers its object for sceUltUlthreadGetSelf, yields that thread, and exits it with the status sceUltUlthreadJoin and sceUltUlthreadTryJoin return. Outside an ulthread the three return ULT_ERROR_STATE.
2026-10-20 14:35:34 +03:00
Yossi Yadgar ea3e23bd86 feat(libSceUlt): implement the reader-writer lock
Readers share the lock while no writer holds it and a writer waits until it is free. Destroying a held or waited-on lock and destroying the waiting-queue pool of a lock a thread waits on return ULT_ERROR_BUSY, and sceUltFinalize wakes waiters with ULT_ERROR_STATE, as for the mutex.
2026-10-20 14:35:34 +03:00
Yossi Yadgar e2c38222fe feat(libSceUlt): implement the semaphore, queue, pool and ulthread option initializers
Each clears its 128-byte option structure, as sceUltMutexOptParamInitialize and sceUltUlthreadRuntimeOptParamInitialize already do.
2026-10-20 14:35:20 +03:00
Yossi Yadgar 9d84fac304 feat(libSceUlt): implement sceUltMutexTryLock
It takes a free mutex or relocks one the caller holds, as sceUltMutexLock does, and returns ULT_ERROR_BUSY instead of waiting when another thread holds it.
2026-10-20 14:35:20 +03:00
Adrià FranchandClaude Sonnet 5.5 99e56464a1 fix(libkernel): keep the PipeWrite full-pipe case off Windows and start its clock before the reader
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 13:35:07 +02:00
Alexej Szpevák bd8ee518c4 feat(libkernel): support EVFILT_WRITE on the write end of a pipe
kevent threw for EVFILT_WRITE on any descriptor that is not a socket. On the write end of a pipe it now follows FreeBSD 11's filt_pipewrite: data is the free buffer space, and once the read end is closed the event reports EV_EOF with data 0. Adding the event after the read end is closed fails with EPIPE, as in pipe_kqfilter. EVFILT_WRITE on the read end still throws, because FreeBSD's pipe ends are bidirectional and host pipes are not.
2026-10-20 13:34:50 +02:00
Alexej Szpevák 92e136a129 feat(libkernel): report the write end of a pipe to equeue descriptor polls
GuestSockets::Ready only knew the read end of a pipe, and WaitAny asked the host for POLLIN on every descriptor that is not a socket, so a write interest on a pipe could never be reported or wake a wait. PipeWriteState gives the free space of the host buffer (F_GETPIPE_SZ less FIONREAD on Linux, the write quota on Windows), EOF once the read end is closed, and whether the host takes a write now; Ready reports the write end when it is writable or at EOF, and WaitAny asks for POLLOUT on it. macOS has no call for the capacity of a pipe and throws.
2026-10-20 13:34:50 +02:00
milescovielloandClaude Opus 5.5 0fdc0e22b3 fix(libSceNgs2): make a rack lock wait for another thread's render
A voice callback runs with the internal lock released, so another
thread could lock the rack being rendered and the render then finished
it under that lock. sceNgs2RackLock now also waits while another thread
renders the rack's system, as it did when the rack lock was the
internal lock.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-20 11:34:14 +00:00