Commit Graph
12196 Commits
Author SHA1 Message Date
xxLnolan 30454880de fix(libc): implement PAF mspace memalign 2026-10-19 13:59:05 +02:00
Nithishvelan M 0f34160a49 feat(libc): export tgammaf float math function
PPSA26578 (issue #7624) imports tgammaf (NID B2ZbqV9geCM) from libc,
and its bundled libc.prx does not export it, causing the process to
exit with 0xC0000139 (GetLastError: 127).

Export tgammaf_nid_postfix in core/libs/prx/libc/src/Math.cpp delegating
to std::tgamma(float), and add unit test coverage in GuestMath
verifying factorials, half-integers, poles, and negative values.
2026-10-19 17:27:50 +05:30
Alex ColliniandClaude Opus 5.5 1d8acd1eda fix(agc): skip a periodic pipeline cache save while a pipeline creation holds the cache
The saver thread took the snapshot lock with a blocking exclusive lock. Behind
a pipeline creation that runs for minutes (an NVIDIA compile of a 1.5M-word
compute pipeline), the queued writer made the shared_mutex hold every later
pipeline creation on every queue until the compile ended. The periodic save now
tries the lock and waits for the next interval when it is busy; SaveNow and the
teardown save still wait.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 13:57:50 +02:00
Nithishvelan M 6487d5e2c5 feat(libc): export nextafter double math function
PPSA26578 (issue #7624) imports nextafter (NID h+J60RRlfnk) from libc,
and its bundled libc.prx does not export it, causing the process to
exit with 0xC0000139 (GetLastError: 127).

Export nextafter_nid_postfix in core/libs/prx/libc/src/Math.cpp delegating
to std::nextafter(double, double), and add unit test coverage in
GuestMath verifying denormals, infinities, NaNs, and negative zero.
2026-10-19 17:25:31 +05:30
alfalfa-starandClaude Opus 5.5 713f5c2678 perf(agc): drop the cached space's committed-page memo
Kena's cached-space hits have no copied ranges, so the memo of their
committed pages saved nothing (imports pass 0 us per build with and
without it), and keeping it current needed a second commit-generation
bump in libc. The space is still stamped once per hit; the test that
commits pages between two hits stays.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 13:55:04 +02:00
alfalfa-starandClaude Opus 5.5 587d1d123c fix(agc): keep a cached space's committed pages per commit generation
The memo of a cached address space's committed pages is published
lock-free and rebuilt when the arena's commit generation moves, which a
commit now advances again when it ends. A trimmed space's last hit
moves back to its imports, and the space hit longest ago is trimmed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 13:55:04 +02:00
alfalfa-starandClaude Opus 5.5 a8dea52d11 perf(agc): reuse a cached address space's committed pages on a hit
A hit in the read-only V# address-space cache described the committed
pages of every copied range again and stamped the space once per import.
The cached space now keeps its copied ranges' committed pages and is
stamped once per hit. APS5_NO_SPACE_COMMIT_MEMO=1 and
APS5_NO_SPACE_STAMP_ONCE=1 turn the two parts off.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 13:54:55 +02:00
Nithishvelan M 2165427879 feat(libc): implement std::_Throw_bad_optional_access
PPSA26578 (issue #7624) imports _ZSt26_Throw_bad_optional_accessv (NID
KwzEip7m6TM) from libc, and its bundled libc.prx does not export it,
causing the process to exit with 0xC0000139 (GetLastError: 127).

Implement std::bad_optional_access type record and vtable deriving from
std::exception, thrown through ThrowPlain, with what() returning
"bad_optional_access", and add unit test coverage in ExceptionRuntime.
2026-10-19 17:22:27 +05:30
Dean 6762694735 Merge pull request #7761 from angleboyndn-stack/fix/libc-secure-string-destination-limits
fix(libc): reject oversized secure string destinations
2026-10-20 00:52:00 +13:00
thuanquangandClaude Opus 5.5 9c048ee162 test(agc): skip kept-denormal f64 add and mul rows a device cannot preserve
As for the f64 rounding test: on a device without f64 DenormPreserve, a
mismatch in the modes that keep f64 denormals is reported as skipped;
the modes that flush them are still checked everywhere.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 18:49:58 +07:00
thuanquangandClaude Opus 5.5 01ed9192ed fix(shader): flush v_add_f64 and v_mul_f64 denormals by the f64 field
v_add_f64 and v_mul_f64 ignored the FLOAT_MODE f16/f64 denormal field.
On RDNA2 (gfx1031) bit 6 clear flushes both inputs to a zero of their
sign, and bit 7 clear flushes a sum below 2^-1022 and a product whose
exact value rounded to 53 significant bits with an unbounded exponent
is below 2^-1022. The product test scales one source by 2^64 and
compares the host product with 2^-958.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 18:49:58 +07:00
ionut27001andClaude Opus 5.5 dca67ae477 fix(libkernel): return kern.rng_pseudo in 64-byte blocks as measured on a PS5
In a payload process on a PS5 (firmware 12.70),
sysctlbyname("kern.rng_pseudo") answers a size query with 64 and gives
at most 64 bytes per call, up to a 65536-byte buffer. A buffer smaller
than 64 bytes gets as many bytes as its length and a null length gets
none, both with -1 and ENOMEM; a null buffer with a null length returns
0, and errno is kept when the call succeeds. Here the whole buffer was
filled, a size query threw and the length was never changed. The 64
random bytes are now drawn only for a read that passes both a buffer
and a length.

AI-assisted: yes

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 14:49:39 +03:00
Adrià bbb45463c7 Merge pull request #6849 from al3w0f205/feat/audiopropagation-firmware-exports
feat(libSceAudioPropagation): export missing firmware functions from database
2026-10-19 13:46:36 +02:00
Adrià 87aee045df Merge pull request #6821 from JJenkx/fix/point-context-sdk-defaults
fix(agc): initialize point size and limits from SDK defaults
2026-10-19 13:45:12 +02:00
Adrià 2b6c1112b8 Merge pull request #6763 from SP4C3B4R-8/perf/windows-draw-input-copies
perf(agc): copy draw inputs on NVIDIA's Windows driver instead of binding host imports in place
2026-10-19 13:45:06 +02:00
Adrià db73af3506 Merge pull request #6831 from ErenYeager1836/fix/savedata-sync-memory-init-check
fix(libSceSaveData.native): return error for uninitialized sceSaveDataSyncSaveDataMemory
2026-10-19 13:43:56 +02:00
Adrià 77b3edf32a Merge pull request #6841 from Sevthered/feat/ajm-pcm-resample
feat(ajm): resample interleaved s16 PCM through codec 23
2026-10-19 13:38:50 +02:00
milescovielloandClaude Opus 5.5 1427802578 fix(agc): map the AGC driver memory past ASan's shadow in an ASan build
An ANYPS5_ENABLE_ASAN build moves the guest arena up by 0x100000000000,
past AddressSanitizer's shadow gap, but the AGC driver memory that holds
the FS table (#6160) is still mapped at the fixed 0xfe0000000. That
address is in the shadow gap, so the mapping fails with EEXIST and no
test that initializes the driver runs under ASan.

The offset is now GuestArena::GuestAddressOffset in GuestArena.hpp, and
the driver memory and the FS table move by it like the arena. Builds
without ASan keep 0xfe0000000. agc_driver_compute_fs_table_calls skips
in an ASan build: its shader builds the PS5's fixed table address from
literals, as titles' shaders do, and that address can't be mapped there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 11:38:29 +00:00
Adrià 62e946f114 Merge pull request #6833 from ErenYeager1836/feat/libkernel-sysconf-limits
feat(libkernel): support _SC_ARG_MAX, _SC_OPEN_MAX and _SC_IOV_MAX in sysconf
2026-10-19 13:37:44 +02:00
MarcZX10 7fdfe4493a fix(libScePngDec): reject misaligned output buffers 2026-10-19 11:35:17 +00:00
David 6eb29b8fe7 test(libkernel): check the macOS open file limit against EMFILE
guest_getrlimit failed on macOS because the host's soft and hard
RLIMIT_NOFILE differed. On macOS it now also checks that the limit does
not exceed kern.maxfilesperproc, and, as on Windows, that guest pipes
fail with EMFILE within 64 descriptors of the reported limit. The pipe
loop moves into a helper that both use.
2026-10-19 13:34:50 +02:00
David 0cb9d92b56 fix(libkernel): set the open file limit at load on macOS
getrlimit(RLIMIT_NOFILE) reports the host's limits, and libkernel
raised the soft limit to the hard one at load only on Linux. On macOS
the soft limit stayed below an unlimited hard limit (1048576 and
infinity in a shell here, 256 and infinity by default), so the two
differed. XPSemu (PPSA97358) then raises the soft limit to the hard one
in QEMU's os_setup_limits, and setrlimit refuses the change.

macOS fails with EMFILE at kern.maxfilesperproc (10240 here) whatever
the soft limit, even an unlimited one. At load, libkernel now sets both
limits to the smaller of the hard limit and kern.maxfilesperproc, so
getrlimit reports the descriptor count after which opening fails. The
Linux path still raises the soft limit to the hard one.
2026-10-19 13:34:29 +02:00
thuanquangandClaude Opus 5.5 5b6101e1ae test(agc): skip kept-denormal f64 rounding rows a device cannot preserve
Lavapipe reports no f64 DenormPreserve, so the shaders get no
DenormPreserve 64 and it may flush f64 denormals; the rows of modes that
keep them then fail with or without the recompiler change (frexp, floor,
ceil and fract of 2^-1074 on Mesa 25 and 26). As in F64FmaSubnormals,
a mismatch in those modes is reported as skipped on such a device. The
modes that flush f64 denormals are still checked on every device.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 18:34:17 +07:00
thuanquangandClaude Opus 5.5 abea1bc710 fix(shader): flush f64 floor, ceil, fract and frexp denormal inputs
v_floor_f64, v_ceil_f64, v_fract_f64, v_frexp_mant_f64 and
v_frexp_exp_i32_f64 ignored the FLOAT_MODE f16/f64 denormal field. On
RDNA2 (gfx1031) bit 6 clear flushes a denormal input to a zero of its
sign, so v_ceil_f64 of 2^-1074 is 0 instead of 1, and bit 7 clear
flushes the denormal result v_fract_f64 gives for a positive denormal.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 18:34:17 +07:00
MarcZX10 73e472b3c2 fix(libScePngDec): reject oversized alpha values 2026-10-19 11:33:45 +00:00
MarcZX10 d0119e5686 fix(libScePngDec): validate custom decode pitch 2026-10-19 11:30:20 +00:00
Ondra97 59dbdd615a Merge remote-tracking branch 'origin/main' into codex/pr6593-review-fix-20261019 2026-10-19 13:29:42 +02:00
Ondra97 921b8408d4 perf(shader): keep redundant expression operand keys inline 2026-10-19 13:24:47 +02:00
MarcZX10 0a6c3880f3 fix(libScePngDec): enforce decode width limit 2026-10-19 11:24:42 +00:00
Ondra97 9ee4af350e test(json2): isolate Linux allocation failures from guest unwinding 2026-10-19 13:24:36 +02:00
Adrià 7a36de66b9 Merge pull request #6823 from ErenYeager1836/feat/libSceSysmodule-is-loaded-internal
feat(libSceSysmodule): implement sceSysmoduleIsLoadedInternal
2026-10-19 13:24:27 +02:00
Adrià 3691f6ffc2 Merge pull request #6826 from hugodearaujo/fix/page-table-stats-console
fix(libkernel): count page-table entries the way the console does
2026-10-19 13:24:22 +02:00
WernerandClaude Opus 5.5 2ac433e3cb feat(libc): list stack return address candidates in the hang dump
The Windows crash report walks every other thread's rbp chain only, so
a thread waiting inside ntdll or in code built without frame pointers
showed no frames at all. For a thread whose chain yields fewer than two
frames, scan the 32 KiB above its rsp while it is suspended and print
up to 24 words that point at executable memory.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01T86KdkUbEv7m5hrCbPbkAp
2026-10-19 13:24:02 +02:00
RengundomandClaude Opus 5.5 88f8184102 fix(trace): write the benchmark file safely and off the presenter
Review of the benchmark report:

- The file is written to `<name>.tmp` and moved over the previous one, so a
  crash or kill during a rewrite keeps the last complete report.
- A dedicated writer keeps only the newest pending snapshot, so two reports
  can no longer be joined into one file when the writer falls behind.
- The report is formatted on the writer thread. The presenter hands over the
  kept intervals, which are shared and never copied, so the interval that
  closes no longer pays for formatting every earlier one.
- Hosts that are not x86 or report no CPU brand string leave the host fields
  out instead of failing every summary line.
- A `contentVersion` that is not a string, or does not fit, is left empty
  instead of failing the title's metadata.
- Tests cover the 240-interval rotation and `intervals_dropped`, the
  newest-only writer, the pending write on stop and the atomic replace.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 06:21:04 -05:00
Adrià f6eeca4f5f Merge pull request #6786 from fdfawef324/claude/agc-indirect-args-stale
fix(agc): wait for address-based writers before reading indirect dispatch arguments
2026-10-19 13:16:24 +02:00
akkadbakkad89 8f3849e791 fix(prx): correct the offline NP WebAPI error code and list silent stubs 2026-10-19 11:16:04 +00:00
Adrià 12e42b2730 Merge pull request #6660 from al3w0f205/fix/agcdriver-wait-reg-mem-masking-and-pipeline-drain
fix(libSceAgcDriver): mask WAIT_REG_MEM addresses and elide non-overlapping pipeline drains
2026-10-19 13:15:39 +02:00
Ondra97 7f14bc7afb Merge remote-tracking branch 'origin/main' into codex/pr6593-review-fix-20261019 2026-10-19 13:08:04 +02:00
Lindamea1andClaude Opus 5.5 d8baccc195 feat(libSceNetCtl): declare sceNetCtlGetInfoV6
libSceNetCtl exports sceNetCtlGetStateV6, sceNetCtlRegisterCallbackV6
and sceNetCtlUnregisterCallbackV6 but not sceNetCtlGetInfoV6 (NID
Jy1EO5GdlcM). Dragon Ball Xenoverse 2 (PPSA08587) imports it, and an
import that no system library exports stops a title before its entry
point: on Linux ld.so refuses the relinked executable with "undefined
symbol: Jy1EO5GdlcM", and on Windows the entry stub prints "FAIL:
unresolved ELF import Jy1EO5GdlcM from libSceNetCtl.prx" and raises
0xC0000139. The title's tester reports that it does not call the
function before its loading screen.

It is a Sony network-control call with no FreeBSD counterpart, and
neither its parameters nor the IPv6 info layout are known, so it is
declared without parameters and throws through
NotImplemented_nid_no_patch, as CONTRIBUTING.md asks of exports that
cannot be implemented. The gap is recorded in
docs/dev/debt/libSceNetCtl.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 12:07:45 +01:00
Adrià 97d5d7a52a Merge pull request #6737 from fogydes/fix/libkernel-eventflag-deletion-and-multiwaiter-race
fix(libkernel): prevent use-after-free on event flag deletion and multi-waiter race
2026-10-19 13:05:18 +02:00
Adrià d957f18282 Merge pull request #6793 from al3w0f205/test/game-live-streaming-coverage
test(libSceGameLiveStreaming): add guest game live streaming test coverage
2026-10-19 13:05:12 +02:00
milescovielloandClaude Opus 5.5 c2764f31f2 fix(agc): draw a PS_ITER_SAMPLE program once per pixel into a one-sample depth target
A one-sample depth target under a multisampled rasterizer without
MSAA_ENABLE is drawn as a one-sample draw at the pixel center, but a pixel
program that runs with PS_ITER_SAMPLE threw. Ghost of Tsushima (PPSA02225)
draws its depth-only pass this way (2x PA_SC_AA_CONFIG, PA_SC_MODE_CNTL_1
0x06030000, KILL_ENABLE, no sample index or coverage input) and stops on it.

Every sample is taken to be at the pixel center on this path, so
invocations per sample would get the same inputs and give the same depth,
kill and color results, and the target keeps sample 0's. Such a program is
now drawn once per pixel, without sample shading. ANCILLARY and
SAMPLE_COVERAGE inputs still throw. The debt entry notes that only the
memory writes of such a program can differ.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 11:05:02 +00:00
Adrià Franch bd7453d97a test(libc): set the zone through the guest environment in tzname and region-zone checks 2026-10-19 13:04:13 +02:00
MarcZX100 783c70de53 fix(libc): refresh tzname after implicit TZ changes 2026-10-19 13:03:54 +02:00
Hussein Kadhim b49644c83d fix(libc): read the guest TZ once per outermost time conversion
Nested conversions such as the one closing mktime no longer re-read TZ, so
the instant and the normalised fields come from one zone. The race test now
covers mktime and strftime.
2026-10-19 13:03:54 +02:00
Hussein Kadhim 6b03cf445f fix(libc): serialise guest TZ changes with time conversions
Copy the guest TZ under the guest environment lock so a concurrent setenv
cannot free it while it is read, and hold one lock across the zone switch
and the conversion so the fields of two zones are never mixed. Document the
host rejection, Windows zone name and stale tm_zone limits.
2026-10-19 13:03:54 +02:00
Hussein Kadhim 7d1140d962 fix(libc): apply the guest TZ to tzset, localtime, mktime and strftime
Guest setenv, putenv and unsetenv only change the guest environment, while
the time conversions read the host TZ, so a guest that set TZ and called
tzset still got host local time. Copy a changed guest TZ to the host before
each local conversion and call tzset again.
2026-10-19 13:03:54 +02:00
Lindamea1andClaude Opus 5.5 4faf57a986 feat(libs): add the Voice and IME exports PPSA24191 needs to load
Monster Hunter Wilds imports sceVoicePausePort, sceVoiceResumePort and
sceImeSetConsecutiveClauseConversionEnabled, which no library exported,
so the loader stopped at the first of them.

sceVoicePausePort and sceVoiceResumePort check the library and the port
like sceVoiceResetPort. sceImeSetConsecutiveClauseConversionEnabled has
no public reference and throws.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 12:01:08 +01:00
umangandClaude Opus 5.5 aca898eeea fix(agc): release a queued DMA copy's held source read when it runs
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 12:57:48 +02:00
umangandClaude Opus 5.5 f1c4a0baee test(agc): keep the gate closed until the queued draw's vertex hold is checked
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 12:57:48 +02:00