Commit Graph
5577 Commits
Author SHA1 Message Date
LuisBiceps 9850628e1b test(libc): reset errno after the worker thread in guest_errors
guest_errors sets errno to 13 and checks at the end that the strerror_r
calls left it alone, but a std::thread is created and joined in between.
Guest errno is the host's errno. Since glibc 2.42, pthread_create first
tries madvise(MADV_GUARD_INSTALL) for the new thread's stack guard.
Kernels before 6.13, including WSL2's 6.6, reject it with EINVAL, and
glibc falls back to mprotect with errno left at EINVAL. POSIX leaves
errno unspecified after a successful call, so the test aborts on Ubuntu
26.04 (glibc 2.43) under WSL2 without anything being wrong.

Check errno right after the strerror calls, and set it to 13 again after
the join, so every errno check covers only strerror and strerror_r.
2026-10-09 01:21:00 +08:00
MathiasDevelopesandClaude Opus 5.5 2c7d9b9c82 feat(agc): DMA_DATA prefetches to DST_SEL nowhere
DMA_DATA with DST_SEL 2 (V_411_NOWHERE in Mesa's src/amd/common/sid.h)
reads its source into L2 and stores nothing; libSceAgc emits it as an
L2 prefetch with the source address repeated as the destination. It
threw as a register or prefetch destination. A prefetch of a memory
source is now accepted and writes nothing: ResolveStore returns it as an
empty store, so the packet stays ordered without a drain,
DecodeMemoryCopy keeps rejecting it and Execute skips it. A prefetch of
a register, GDS or immediate source and a register destination still
throw.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-08 19:12:54 +02:00
muhzain05 fd597084f9 fix(ult): reject finalize with outstanding ulthreads
sceUltFinalize cleared gUlthreads directly, dropping the last
shared_ptr to an UltUlthreadState while its worker thread still held
the raw pointer passed to scePthreadCreate. Finalize now returns
ULT_ERROR_BUSY when an ulthread is still registered, before any global
state is torn down, following the BUSY convention of the queue,
semaphore and queue data pool destroy paths. Joining the ulthread
remains the caller's responsibility, as sceUltUlthreadJoin already
keeps the state alive across scePthreadJoin and erases it afterwards.
2026-10-08 10:51:50 -06:00
boykopovar 8b15d88839 fix(shader): use guest wave lane for ADD_TID on narrow subgroups 2026-10-08 19:48:08 +03:00
alfalfa-starandClaude Opus 5.5 45541350bb feat(agc): accept UINT16_ABGR color exports into unsigned integer targets
SPI_SHADER_COL_FORMAT 7 (UINT16_ABGR) was rejected by DecodeState,
though the recompiler already handles it: a pixel shader's MRT output
under mode 7 is a uvec4, and a compressed export's 16-bit halves are
taken with OpBitFieldUExtract. The format is now accepted when the
target's CB_COLOR_INFO number type is UINT; into any other target it
still throws, as does SINT16_ABGR (8), whose halves would need sign
extension.

The target records the export (ColorTarget::uintExport). Shader
validation then requires a uint4 output at its location instead of a
float4 one, and blending into it is refused (Vulkan has no blending of
integer attachments).

PPSA14632 (LEGO Horizon Adventures) writes a 2848x1600 R8_UINT target
this way; those draws were dropped.

agc_driver_pixel_uint16_export draws compressed MRT0 exports under mode
7 into a linear 16_16_16_16 UINT target, one row per pair of packed
words (0x0000ffff/0xffff0000, 0x00010002/0xffffffff and four distinct
halves), and reads every 16-bit component back under the identity,
STD_REV and ALT_REV export mappings. agc_driver_graphics covers the
decode and the blend refusal.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-08 18:46:09 +02:00
overlordxrz-source 18798620e8 feat(libkernel): implement sysctl and sysctlbyname for hw.ncpu
ScreenTester5 (PPSA69420) stops at start-up on the unresolved sysctlbyname
import and also imports sysctl. hw.ncpu (CTL_HW.HW_NCPU) reports the same
processor count as sysconf(_SC_NPROCESSORS_ONLN). Other names and MIBs throw.
2026-10-08 12:23:05 -04:00
boykopovar 199eeb1805 fix(shader): preserve structured exits during SPIR-V specialization 2026-10-08 19:19:50 +03:00
emirplus c4c3ed7711 fix(savedata): recover from metadata setup failure
Report SAVE_DATA_ERROR_INTERNAL when setupSaveDataMemory2 fails to persist initial SaveDataParam metadata, and restore previous state so retrying setup can initialize cleanly. Closes #1667.
2026-10-08 19:18:36 +03:00
boykopovar 2767da6a8a fix(tests): check Vulkan availability before shader registration 2026-10-08 19:09:13 +03:00
MichonandClaude Opus 5.5 7208d7d314 fix(agc): a key fill over other images stays inside the image's DCC key extent; test the fill cover
When another live image overlaps the fill, a fill at a live image's dccAddress is a key fill
only while it stays within DccKeyCount (the pipe-aligned key count); with nothing overlapping
the length rule is unchanged. ClassifyFill, NoteKeysFill and ClearByKeysFill share the match.
agc_driver_fill_cover_keys pins Keys, Inside and Several for fills at and beside the keys.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-08 18:06:37 +02:00
boykopovar 2da24e8a62 fix(tests): keep bindless image selection within one host subgroup 2026-10-08 19:04:45 +03:00
klosixgaming-arch 5d3029b45a fix(shader): work around Intel iGPU OpSMulExtended bug
Use Hacker's Delight 8-3 formula for signed multiplication high words:
hi = umulhi(a,b) - (a<0 ? b : 0) - (b<0 ? a : 0)

This avoids using OpSMulExtended entirely, which returns wrong high words
for constants -1, -2, and -32768 on Intel iGPUs. The workaround is exact
for all inputs and has no performance impact on other platforms.

Fixes #1246
2026-10-08 11:02:58 -05:00
Morten HolmandClaude Sonnet 5.5 20e8bb09ba fix(libc): run guest exit handlers before the host exit handlers
LibcExit called std::exit, which ran the static destructors of the libraries
before the guest exit handlers. A guest handler that freed memory then locked
a destroyed std::mutex, which throws, and a noexcept guest destructor ended in
std::terminate. The guest handlers now run first, while the library objects
are alive.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-08 17:53:56 +02:00
Jan ŠléglandClaude Fable 5.1 e6a9b50512 feat(libkernel): implement the sigset functions
Add sigemptyset, sigfillset, sigaddset, sigdelset and sigismember with
FreeBSD 11 semantics (lib/libc/gen/sigsetops.c): a 128-bit set of four
32-bit words, signal n at bit n - 1, signals 1 to 128 valid. sigfillset
sets every bit. An invalid signal returns -1 with errno EINVAL and leaves
the set untouched; sigismember returns 1 or 0. A null set throws.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-10-08 17:45:57 +02:00
boykopovar e4c604d64e fix(shader): update linux shader cache structure size assertions 2026-10-08 18:43:06 +03:00
emirplusandClaude Opus 5.5 b4cc6d26b9 feat(relinker): support Windows guest TLS reads by ALU register-address instructions
Recognize read-direction ALU forms (add, or, adc, sbb, and, sub, xor, cmp) that read from fs:[mem] where mem has a base or index register (such as 64 48 33 03, xor rax, fs:[rbx], in #217). The stub loads the TLS value through the computed address, performs the ALU operation, and preserves scratch registers and flags.

Extend test_tls_function_coverage with execution and stub coverage cases for register-addressed ALU operations, including rax, rcx, rbx and r13 destinations, wide and 32-bit forms, and verification of register and flag preservation.

Refs #217

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-08 18:39:24 +03:00
Pedro a294b80d29 feat(libkernel): implement getuid, geteuid, getgid, getegid and issetugid
Part of #1578.
2026-10-08 10:39:06 -05:00
XairRrR df3aa1a9db fix(libkernel): raise the open file soft limit on Linux
Each direct memory backing keeps a memfd open, so a title such as
Dreaming Sarah (PPSA02929) holds about 1100 descriptors at startup.
With the systemd default soft limit of 1024, later opens fail with
EMFILE: memfd_create throws "create direct memory backing: Too many
open files", or the title's fopen returns NULL and it faults in fread.

libkernel now raises the RLIMIT_NOFILE soft limit to the hard limit
when it is loaded, before the title creates any descriptor, and throws
if the limit cannot be read or raised.
2026-10-08 17:38:48 +02:00
Nahuel Genchi 5115c24fc7 Merge branch 'main' of https://github.com/boykopovar/AnyPS5 into fix-flip-compute
# Conflicts:
#	core/libs/prx/libSceAgcDriver/CMakeLists.txt
2026-10-08 12:36:13 -03:00
st44rplatinum 7894cda94d feat(libSceSystemService): implement Disable/ReenableMediaPlay 2026-10-08 18:35:19 +03:00
boykopovar 6741e90a1c fix(shader): restore prepared image compatibility and update regression fixtures 2026-10-08 18:32:12 +03:00
Morten HolmandClaude Sonnet 5.5 5333a20537 fix(agc): do not use fragment barycentric on MoltenVK
MoltenVK reports VK_KHR_fragment_shader_barycentric, but its SPIR-V to MSL step
rejects the PerVertexKHR decoration that the barycentric path uses, so every
pixel shader on that path fails to compile into a pipeline. Treat the feature
as unavailable when the driver is MoltenVK, so the no-barycentric path is used.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-08 17:31:20 +02:00
7647710248 test(audiodec): cover the raw M4AAC configuration search with a 5.1 stream
A raw 5.1 LC frame decodes as 6 channels with a maximum of 6 and of 8,
which is only reached by moving past the mono/stereo configuration. The
configuration search is listed under unknown function info, together with
a mono raw stream being reported as 2 channels.

Co-authored-by: Dextroid17 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-08 17:29:50 +02:00
PacukaandClaude Opus 5.5 7b722253a4 fix(audiodec): take the M4AAC raw channel layout from the stream
For a raw M4AAC stream the maximum channel count was written into the
AudioSpecificConfig as the channel configuration. The maximum only bounds
the stream: The Smurfs Dreams creates its decoder with 8 channels at most
and sends stereo, so FFmpeg refused configuration 8 (reserved) and a
stereo stream under configuration 6 or 7 decodes no frame. The decoder
now starts from the mono/stereo configuration and on the first access
unit that it cannot decode moves on to the configurations with more
channels, up to the maximum, keeping the first one that decodes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-08 17:29:46 +02:00
MichonandClaude Opus 5.5 fc05d1e3e3 fix(agc): a fill of a surface's DCC keys is a key fill over other images' memory
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-08 17:27:13 +02:00
boykopovar 0fa7114e93 fix(tests): correct raw buffer bounds in DCC many-buffer and interlock tests 2026-10-08 18:24:15 +03:00
boykopovar d0a62b7ba0 fix(tests): correct raw buffer bounds modes in image tests 2026-10-08 18:21:50 +03:00
boykopovar 381d12b3b4 fix(tests): correct buffer bounds modes in GDS LDS and scalar tests 2026-10-08 18:20:08 +03:00
Mohd FaourandClaude Fable 5.1 ce5a2136a8 fix(sysmodule): report a module that is not loaded as SCE_SYSMODULE_ERROR_UNLOADED
sceSysmoduleIsLoaded returned 0x80A90002 and the unload calls 0x80A90003
for a module that is not loaded. Neither value exists in the SDK: the
sysmodule facility is 0x5A and the error is 0x805A1001, which titles
compare against (GTA V PPSA04263: cmp eax,0x805a1001 after IsLoaded) to
decide whether to load and initialise the module themselves. Return that
value from all three places and cover it in guest_sysmodule.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-10-08 17:13:02 +02:00
boykopovar bae0aed3bf fix(driver): adapt shader preparation to updated main apis 2026-10-08 18:12:47 +03:00
ahmedhamouda78 73eb8465d6 feat(agc): write the measured sceAgcDcbResetQueue packet sequence
Replace the CLEAR_STATE approximation with the envelope and per-op-bit packet groups measured on PS5 firmware 13.60. Emit groups for op bits 0x001, 0x002, 0x004, 0x008, 0x010, 0x020, 0x080, 0x100 and 0x800 in ascending order; throw for 0x040, 0x200 and 0x400 whose packets the driver rejects. state 2 sets the envelope flag and state 3 sets the 0x004 and 0x800 group payload dword.
2026-10-08 15:10:08 +00:00
Leandro 9bae5b0879 Merge branch 'main' into fix/kernel-download0-at-start 2026-10-08 17:09:06 +02:00
boykopovar eb68ad3b02 fix(shader): preserve main buffer alignment and image formats in prepared shaders 2026-10-08 17:51:05 +03:00
Adrià eb2818f505 Merge pull request #1476 from awake-devel/fix/timedwait-nested-waiter
fix(libkernel): give each nested TimedWait its own waiter on Windows
2026-10-08 16:48:48 +02:00
Scott SchusterandClaude Opus 5.5 a43f1411c4 fix(libc): align guest heap allocations to 32 bytes
Clang's PS4 and PS5 targets set the default new alignment and the suitable
alignment to 32 bytes, so PS5 code may store to a fresh malloc or operator
new result with 32-byte-aligned AVX instructions. The guest heap aligned
blocks to 16 bytes, and the arena's 32-byte classes put every small block
16 bytes past a 32-byte boundary after its header, so such a store faulted.
The minimum alignment is now 32 bytes; the padding still assumes only the
16-byte alignment the raw blocks guarantee.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-08 09:42:06 -05:00
Scott SchusterandClaude Opus 5.5 f983f51223 fix(agc): write queued labels at a suspend point before a device exists
A suspend point flushes the labels queued since the last submission. It
recorded them only when a Vulkan device existed, and the device is created
lazily, so labels queued by a title that had not yet drawn were never
written. RADV ends each submission with a RELEASE_MEM to a marker it polls
from the CPU; when the end of that submission was folded into a following
suspend point, the marker stayed at 0 and RADV reported the device lost.
The labels are now recorded either way, which writes them from the CPU
without a device.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-08 09:40:37 -05:00
boykopovar 082f371758 fix(shader): correct emulated color comparison specialization 2026-10-08 17:40:12 +03:00
boykopovar 4b5a395219 fix(shader): correct msaa sample addressing and prepared test failure cleanup 2026-10-08 17:40:10 +03:00
boykopovar 6a4c5b5ded fix(shader): support non-array image views and packed unorm runtime modes 2026-10-08 17:38:11 +03:00
boykopovar e5cd1c6079 test(font): avoid deleting an open system font on windows 2026-10-08 17:37:40 +03:00
boykopovar 1b3da3a740 test(agc): update graphics binding and bda range checks 2026-10-08 17:37:40 +03:00
boykopovar c3e6727163 fix(agc): prune expired rectangle preparation links 2026-10-08 17:37:39 +03:00
boykopovar 6acf4ee0ee test(agc): isolate shader linking and interpolant preparation checks 2026-10-08 17:37:38 +03:00
boykopovar 1f8a7e0b94 test(shader): align specialization checks with runtime abi 2026-10-08 17:37:37 +03:00
boykopovar 19ede29259 test(agc): fix mrt export index and vertex fetch abi checks 2026-10-08 17:37:36 +03:00
boykopovar 8c4e0b1524 fix(shader): propagate binding plan initialization failures outside call_once 2026-10-08 17:37:35 +03:00
boykopovar 6c858dab2c fix(shader): validate unsupported sRGB sampling and SINT d16 writes at materialization 2026-10-08 17:37:35 +03:00
boykopovar 6ac7fbc5a4 fix(agc): stop profile writer before DLL teardown 2026-10-08 17:37:34 +03:00
boykopovar 416e284a31 fix(tests): align prepared shader checks with raw compute caching 2026-10-08 17:37:33 +03:00
boykopovar 92fcdbb1f7 fix(tests): correct buffer OOB modes in image and BVH tests 2026-10-08 17:37:33 +03:00