Commit Graph
12196 Commits
Author SHA1 Message Date
David 0ae412394e fix(relinker): convert stack-guard and thread-pointer reads with an empty PT_TLS for macOS 2026-10-15 18:53:40 +04:00
Romans Pokrovskis 50748f79f2 test(libc): retain the open-host-write alias regression
Retain the regression originally supplied by Pipodi in closed PR5851 (22091410a), adapted here through e1c6af65b. Current-main-equivalent libc/kernel source returns an alias during the open HostWrite and fails this assertion five times. This test is a reproduction, not a new implementation or an upstream PR.

(cherry picked from commit 312170cd0c461104174d655911de876be341cf6a)
2026-10-15 14:52:30 +00:00
Romans Pokrovskis 45625022e7 fix(libc): defer resident alias demotion during a host write
Retain Pipodi safety guard from closed PR5851 without its resident alias expansion or automatic AGC alias routing. Main still refuses aliases over partial resident runs. Five unmodified-main regression runs fail before this guard; positive validation pending. Fork proposal only; no duplicate upstream PR intended.

(cherry picked from commit 078a5740b40c3b5b6384eec8f92363360c75b758)
2026-10-15 14:52:30 +00:00
jweidenh 73ab57d57e test(relinker): page-align the optional RELA guest fixture 2026-10-15 10:41:30 -04:00
Yunus Shaikh 668ecaeca2 fix(agc): fall back to pixel (0,0)'s sample locations where the device has no 2x2 grid
A draw whose sample locations vary between the pixels of the guest's
2x2 pattern threw "sample locations varying between pixels require a
2x2 sample location grid for the draw's sample count" on a device
whose maxSampleLocationGridSize for that sample count is not a
multiple of 2x2. An RTX 3070 Laptop GPU reports 1x1 for every count,
so Resident Evil Village's 2x checkerboard pattern stopped there
before its title.

The pipeline now decides the grid when it is created: such a pattern
is drawn through a 1x1 grid with pixel (0,0)'s locations, the first
registers of the pattern and the pixel the guest's grid is anchored
at, and the first such pipeline of each sample count logs it. The
render pass begin takes the pipeline's grid, so a sample-location-
compatible depth image is begun with the locations it is drawn with.
Devices with the grid keep it, and uniform patterns are unchanged.
2026-10-15 14:36:22 +00:00
jweidenh f40d22067e fix(relinker): accept executables without a RELA table 2026-10-15 10:35:35 -04:00
Bruce Blake 873fbe99aa fix(libkernel): cap getdtablesize at the host descriptor table size
On macOS the RLIMIT_NOFILE soft limit is not a bound on the descriptor table: setrlimit accepts soft limits above kern.maxfilesperproc, RLIM_INFINITY included, and getrlimit reports what was set, so returning the guest soft limit alone could report up to INT_MAX for a table of about 122880 descriptors, and a closefrom-style loop up to that value would run billions of iterations instead of about 122k. Return the smaller of the guest soft limit and the host's ::getdtablesize(), which is the FreeBSD sys_getdtablesize result. The guest test derives its expectation from the host call instead of the implementation's formula, and the debt entry no longer claims the limit is raised when libkernel loads outside Linux. Reported by jotitadev in review of the getdtablesize implementation.
2026-10-15 10:35:04 -04:00
JJenkx c2f375fb63 feat(libkernel): convert guest POSIX error values 2026-10-15 10:34:39 -04:00
Adrià ff23657f34 Merge pull request #2852 from alfalfa-star/feat/np-user-id-by-account-id
feat(npmanager): implement sceNpGetUserIdByAccountId
2026-10-15 16:34:37 +02:00
Adrià f7bc3732e0 Merge pull request #5712 from ErenYeager1836/fix/msgdialog-native-error-codes
fix(libSceMsgDialog.native): return error codes instead of throwing in initialize and terminate
2026-10-15 16:34:28 +02:00
Kraken d971ed011a fix(shader): plan image tables through invariant descriptor phis
Equivalent descriptor reloads in loops must retain runtime table planning. Reuse the existing invariant proof and cover accepted and varying descriptor cases.
2026-10-15 15:32:57 +01:00
capmare 2be7b0769a feat(libSceFontFt): implement the font format support exports 2026-10-15 16:30:32 +02:00
Scott SchusterandClaude Opus 5.5 553690c0d3 perf(recompiler): report which user-data words a resource capture only reads through
The SRT evaluator records every raw read with the user-data word its address is
based on, and marks a word used as a plain value. The result also names the
user-data word behind each shader-data dword.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-15 09:26:58 -05:00
Itamar Medyoni 402a1d0556 test(agc): delete mapped shader cache entries with POSIX semantics on Windows
The disk cache keeps loaded and persisted entries mapped for the life of
the process. On Windows 10 DeleteFileW refuses a file that still has a
mapped view with ERROR_ACCESS_DENIED, so agc_shader_disk_cache failed in
its final remove_all after every check had passed and left its directory
in the temp folder.

Delete each file with FILE_DISPOSITION_FLAG_POSIX_SEMANTICS before
removing the directories, as WriteFileAtomically already renames with
POSIX semantics. The mapped views stay valid, and the test still fails
when a file or the directory cannot be removed. Linux is unchanged.
2026-10-15 17:24:26 +03:00
AlxcBTW e37e5f0aba fix(agc): merge with the cache file unless this object's live cache holds it; test the unseeded double save 2026-10-15 16:19:42 +02:00
billythemenace2andClaude Opus 5.5 01d3594c20 fix(agc): treat a TYPE 1 T# in a read-only static image slot as null
A static, read-only image slot whose T# has TYPE 1 is now bound as a null
image, like TYPE 0 since #5473 and #4779. On gfx1010, image_sample_lz,
image_sample_b, image_load and image_get_resinfo through a format-22
TYPE 1 T# return zeros without a fault, and gfx1035 reads it as zeros
too. Written, atomic and table slots still throw, and the reserved
types 2-7 stay refused.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-15 15:16:56 +01:00
fdfawef324andClaude Opus 5.5 a2f497a05c fix(shader): give a selection a merge when one arm returns through nested branches
mergeBesideReturns ignores the edges into blocks that only lead to a return
when it looks for the merge of a selection whose arms do not meet. It only
recognized a straight run of single-predecessor blocks ending in a return,
so an arm whose return path branches again (an early return inside a
nested if/else) still counted as a block of its own, the arms had no
common post-dominator, and the whole program fell back to flag
structurization ("conditional block 0 has no structured merge").

A block now returns when it has one predecessor, is dominated by the
header and every successor returns. Flag structurization turns every
original block into a guarded region, and the register phis at the region
joins carry values from paths that never reach a later use: in Resident
Evil 4 (PPSA07411) pixel program 0x20762add00 the T# of an image_load
became Phi(0, load through Phi(user data, compare mask)) and resource
analysis refused it. Structured, the T# is the load through the user-data
pointer and the program prepares, captures and materializes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-15 10:11:54 -04:00
Tomás Ortellado 95410ad9e6 refactor(relinker): read ELF header once during validation 2026-10-15 11:11:11 -03:00
Tomás Ortellado e28dbf7666 fix(relinker): reject core and untyped ELF conversion inputs 2026-10-15 11:11:11 -03:00
MarcZX100 2a65acd86c fix(relinker): guard TLS instruction byte access at EOF 2026-10-15 14:05:06 +00:00
Nixitov 443df0551b feat(libkernel_sys): implement fchown
Morrowind imports fchown and stops at it once rtprio_thread and the pthread concurrency controls are in. Accept the guest's own owner and group (0) or unchanged (-1), fail an invalid descriptor with EBADF, and throw for another owner or group, since ownership is not modelled.
2026-10-15 16:02:36 +02:00
Jan ŠléglandClaude Opus 5.5 5532d51fb8 perf(agc): stores beside a range in its 64 KiB block leave the range unchanged
UnchangedSince and UnchangedSinceAll answered by the stamps of the 64 KiB blocks a range
touches, so a CPU or driver store anywhere in a shared block failed every unchanged proof
over it. When a block's stamp is newer, they now look at what wrote the block: the CPU page
stamps over the range and the block's driver-store pieces, as StoredOver does.

For that answer to see every driver stamp, the walk after an own store stamps the pages it
finds dirty in a page map of their own. The unchanged proofs count those pages, so a guest
store beside the stored bytes in the same page is not hidden. StoredOver counts them only in
a block without driver pieces: where pieces exist it answers as before. They take no
driver-piece slot and do not count for the complete coverage StoredAllSince proves. On
Windows, a private mapping made over a block that has driver pieces marks them as
forgotten instead of dropping them.

StoredOver no longer answers stored over for a block whose newer stamp comes only from CPU
stores to other pages.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-15 16:02:27 +02:00
Adrià 0dab493f5b Merge pull request #5816 from Nawasfadili/feat/libc-wide-and-unlocked-stream-io
feat(libc): implement wide and unlocked stream I/O
2026-10-15 15:58:44 +02:00
Adrià 636b1b93cf Merge pull request #5759 from YossiYad/fix/sparse-import-test-backings
test(agc): drop a shared range's backing when the range goes away
2026-10-15 15:58:31 +02:00
Adrià 56f5a6eef7 Merge pull request #5757 from hypermoist/perf/vector-window-unindexed-slots
perf(recompiler): keep the vector window's unindexed slots out of the array
2026-10-15 15:58:23 +02:00
Adrià 5c0cc1bba4 Merge pull request #5755 from AlexOfTheForest/fix/decoder-rip-far-indirect
fix(relinker): report RIP-relative operands of far indirect CALL and JMP
2026-10-15 15:58:16 +02:00
Adrià 281336041a Merge pull request #5754 from fogydes/fix/libkernel-eventflag-clear-pattern-and-attr-validation
fix(libkernel): reject unknown event flag creation attributes
2026-10-15 15:58:10 +02:00
Ondra97 cbb6ddc885 test(libkernel): scope overlapping vector I/O checks to Windows 2026-10-15 15:54:29 +02:00
NeithennnandClaude Opus 5.5 0aba57d294 test(agc): keep waiting for the neighbour copy case's result
The NeighbourCopied case returned Missed as soon as the surface image was
live with nothing pending, although its result had not reached guest
memory yet. It now waits until the result is pending or stored, as
HoldPending does, and only a stored result is a miss.

Fixes #6383

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-15 15:52:10 +02:00
Ondra97 65e95f7139 fix(libkernel): serialize Windows vectored file transfers 2026-10-15 15:48:10 +02:00
Adrià Franch 04b1e9b0b7 fix(libSceIme): reuse ErrorBusy for duplicate keyboard open and record the behaviour in technical debt 2026-10-15 15:45:56 +02:00
Nithishvelan M e485f6ae09 fix(libSceIme): return error codes instead of throwing on duplicate open or close 2026-10-15 15:45:47 +02:00
Nithishvelan M 5e2e135280 fix(libSceSaveDataDialog.native): validate dialog state in close, get result and terminate 2026-10-15 19:14:21 +05:30
Adrià FranchandClaude 61a9ff5ee0 fix(libSceCdlgPlayerReview): ALREADY_INITIALIZED is 0x80B80004
Co-Authored-By: Claude <[email protected]>
2026-10-15 15:43:36 +02:00
Nithishvelan M 6799d87751 fix(libSceCdlgPlayerReview): return error codes instead of throwing in initialize and terminate 2026-10-15 15:43:35 +02:00
Yunus Shaikh 090c0dad15 fix(shader): count a selected record's dwords past its buffer as read
Since 682b07eb0, an image whose dword 3 wasn't captured is poisoned
(OutsideSnapshot). A record selected past the end of its heap reads
nothing there, so it was poisoned instead of selecting a null image, and
agc_shader_bindless and agc_driver_image_table failed after the merge of
main. A scalar buffer load returns zeros past the end of the buffer, so
those dwords now count as read zeros, and the dwords the selection reads
count as captured. Every other path keeps main's rule.
2026-10-15 06:39:33 -07:00
Yunus Shaikh 4344c1dc29 Merge branch 'main' into perf/shader-direct-cpu-evaluable-images 2026-10-15 06:38:09 -07:00
Adrià Franch 6ebab0e73b test(libSceAgc): declare the invalid-argument constant, restore the register defaults version checks 2026-10-15 15:36:49 +02:00
pushkarreddyy fd90df41b6 feat(libSceAgc): implement sceAgcGetDefaultCxStateFlat 2026-10-15 15:36:43 +02:00
simonbronkandClaude Opus 5.5 63db31fdd1 fix(shader): read explicit-LOD and level-zero 2D-array samples through 1D T#s as measured
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-15 15:36:02 +02:00
SandstromPLandClaude Opus 5.5 6f8d9a09d6 fix(relinker): read the PS4 needed-module tag in guest modules
The guest reader took a module's import modules only from 0x61000045,
the PS5 needed-module tag. PS4 modules list them in 0x6100000f
(DT_SCE_NEEDED_MODULE), so every import of a PS4 module had no library
and bound to any guest export with its NID. In the libc.prx and
libSceFios2.prx that Until Dawn (CUSA02636) bundles, a libc.prx import
then bound to libSceFios2.prx, and the conversion failed with "Cyclic
guest initialization dependency: libSceFios2.prx".

The reader now also reads 0x6100000f, with the same layout (module ID
in bits 48-63, name offset in the low 32 bits). A module that has both
tags fails with "Guest module mixes PS4 and PS5 needed-module tags".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-15 19:05:21 +05:30
AlxcBTW d65cc07a1b perf(agc): load the pipeline cache file only on the windowed device and save without re-reading an unchanged file
The headless device is replaced by the windowed one at window attach and then only
lingers for in-flight workers, but it parsed its own full copy of the cache file.
It now starts empty (it still merges what it compiles into the file). Load reuses
the file buffer as the initial data instead of copying it, and save() writes the
live data directly when the file still carries the header this object loaded or
wrote, skipping the read-back and the merge cache.
2026-10-15 15:26:47 +02:00
Sanxchep Sharma b1984ce8d3 fix(agc): preserve position export layout on undecodable tail 2026-10-15 15:25:40 +02:00
MarcZX100 99500f9d45 fix(shader): budget pixel lane proof for NHL 26 replay 2026-10-15 13:21:30 +00:00
MrMha aea1dd601a feat(libc): provide the runtime scripting allocator hooks
Use the registered application allocator and the source-backed alignment/size signature. Add callback ownership and failure checks; record unmeasured console behavior.
2026-10-15 17:21:14 +04:00
hugodearaujo e8b7361a1c fix(agc): settle dma-buf imports on Linux on the settle queue
The kernel maps a dma-buf import's pages for the GPU at the first submission that uses it. On RADV
that took about 2 s for a 3 GiB import, in the second frame of Hades (PPSA03355), and its staging
pool ran out while the frame was held.

Linux now makes the settle queue from #6060 when the device imports dma-buf memory, and settles
every dma-buf import of 1 MiB or more right after it is made with settleImport's 4-byte copy. The
settle queue needs neither the GPU mutex nor the main queue's work to finish. A dma-buf import's
buffer is shared with the settle queue's family instead of aliased, since a sparse import is bound
to many memory objects. Where the sparse queue already takes that family, the settle queue is a
second queue of it.
2026-10-15 10:19:46 -03:00
SandstromPLandClaude Opus 5.5 474ec771bf fix(agc): accept a min or max reduction sampler with anisotropic filtering
A guest S# with FILTER_MODE min or max and an anisotropic XY filter
threw "combines a min or max reduction with anisotropic filtering",
which stops High on Life (PPSA15388) in its home base. It now decodes
to a Vulkan sampler with both anisotropy and the reduction mode, as a
weighted-average anisotropic S# already does. RADV programs the same
S# for such a Vulkan sampler.

Tamalero's gfx1030 measurement on #5156 covers a sample without
derivatives through a 2x anisotropic S# over a single-level texture:
min or max with anisotropic bilinear returns the bilinear minimum or
maximum, and min with anisotropic point the point result. The
execution test checks the bilinear case on the host GPU; the debt
entry records what is not measured.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-15 15:16:41 +02:00
Jan ŠléglandClaude Opus 5.5 9fffceaa9a fix(agc): store pending image results after the range's writers finish
A flush stores a storage image's pending results to guest memory and
keeps the 64 KiB blocks the write tracker shows written since the image
was last in sync. An address-based dispatch marks the pages it stored to
only when its batch's completion runs. A flush between the GPU's store
and that completion found the blocks unwritten and stored the image's
older texels over the newer bytes; a CPU-resolved indirect dispatch then
read those texels as its workgroup counts.

FlushPending now looks for an unfinished batch that writes the range or
holds it in an address-based lease (Recorder::PendingWriterSerial).
Batches that already finished are completed first. If the writer is
still unfinished, the flush finishes the in-flight batches up to it, or
syncs when the writer is in the open batch, so its marks land and its
blocks are kept. Inside a completion action it does not wait. If the
wait throws, the images it took stay registered as pending.

The test stores an image, then a global dword into the image's memory,
and flushes the image twice: once with the writer's batch finished on
the GPU but its completion not run, and once with the writer still in
the open batch. Each time the dword is kept and a texel in another block
is stored. Without write watching the in-flight case is skipped; the
open-batch case still runs, as the write-back then compares guest
memory, which the GPU has not written yet at the flush.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-15 15:11:12 +02:00
eljackjoestar-cmd 81ef1ff485 fix(agc): limit copied-writer waits to copied ranges 2026-10-15 17:09:40 +04:00
Adrià 6359e3466a Merge pull request #5751 from NaitikJoshiPro/pr/agc-raw-graphics-beside-registered
fix(agc): read unregistered graphics programs beside registered shaders
2026-10-15 15:08:26 +02:00