Commit Graph

7061 Commits

Author SHA1 Message Date
Lexroid 7370aaf6d0 feat(agc): decode GS_FAST_LAUNCH geometry with one point per subgroup
VGT_SHADER_STAGES_EN.GS_FAST_LAUNCH = 1 (mesh-style NGG, as RADV programs
it on gfx10.3) was refused. With a point list and GE_CNTL groups of one
point, it launches one subgroup per input point and the first thread
reads that point's index in the ES vertex id VGPR, which the mesh
prologue already provides. The subgroup's primitive limit comes from
GE_NGG_SUBGRP_CNTL.PRIM_AMP_FACTOR, and the GS and ES VGPR counts are
not required to be full.

Fast launch 2, other group sizes or inputs, and indexed fast-launch
draws still throw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 17:00:45 +02:00
Adrià 3b94f923a5
Merge pull request #4633 from QRMOE/fix-libc-wcsxfrm-truncation
fix(libc): terminate truncated wcsxfrm results
2026-10-13 17:00:13 +02:00
Adrià fffe7351ad
Merge pull request #4625 from QRMOE/fix-libc-strtok-exhausted-state
fix(libc): clear exhausted strtok continuation state
2026-10-13 16:59:43 +02:00
Adrià 72a8e67122
Merge pull request #4621 from MiniRML/fix/nid-elf-shared-string-roles
fix(nid): preserve each ELF string consumer independently
2026-10-13 16:59:13 +02:00
Adrià 60fb618708
Merge pull request #4551 from eljackjoestar-cmd/codex/preserve-color-slice-xor
fix(agc): preserve array slice XOR in color target views
2026-10-13 16:52:35 +02:00
Adrià c496fd530f
Merge pull request #4546 from codingreapermaps/feat/libc-call-trace-runtime
feat(libc): record traced import calls on Windows
2026-10-13 16:51:55 +02:00
Adrià b8683834f3
Merge pull request #4596 from MiniRML/fix/oracle-target-override
fix(oracle): honor the current target override
2026-10-13 16:48:06 +02:00
Adrià f2c314e902
Merge pull request #4577 from Moaziz667/fix/prime-remaining-host-mutexes
fix(agc,shader): prime the remaining host shared mutexes
2026-10-13 16:45:17 +02:00
Adrià 2f5c3a4bf5
Merge pull request #4559 from MarcZX100/codex/import-audit-sectionless-modules
fix(tools): audit sectionless guest modules
2026-10-13 16:43:53 +02:00
Adrià b4d76ba609
Merge pull request #4556 from Amoenus/codex/fix-inactive-covered-centroid
fix(agc): admit inactive covered-centroid mode
2026-10-13 16:43:05 +02:00
Adrià ffa2a6ecd3
Merge pull request #4550 from MiniRML/fix/nid-buffer-validation
fix(nid): validate buffer ranges and string terminators
2026-10-13 16:41:04 +02:00
Adrià 69b4ca5d9b
Merge pull request #4215 from Mouad-Scriptz-0/fix/agc-flip-eop-event
fix(libSceAgcDriver): raise the graphics end-of-pipe event from flip packets
2026-10-13 16:39:04 +02:00
Adrià e0d388fa28
Merge pull request #4555 from Xabilimon1/fix/macos-build-libkernel-getrlimit
fix(libkernel): build the fcntl status flags and the getrlimit test on macOS
2026-10-13 16:36:38 +02:00
Adrià b478fbbb1c
Merge pull request #5191 from p3n1cillin/claude/carry-chroot
feat(libkernel_sys): add chroot that keeps the guest root
2026-10-13 16:33:00 +02:00
Adrià 9dac817b19
Merge pull request #4548 from coltken95/fix/libc-printf-nan
fix(libc): print NaN without a sign in the guest printf formatter
2026-10-13 16:31:34 +02:00
Adrià c02df171c8
Merge pull request #4545 from thuanquang/test/tools-python39-hard-links
test(tools): create hard links with os.link for Python 3.9
2026-10-13 16:30:44 +02:00
Adrià 2672a73178
Merge pull request #4501 from devavijitsingh/fix/diagnose-self-module-skip
fix(relinker): warn when SELF modules are skipped
2026-10-13 16:30:12 +02:00
Adrià 80e70b4292
Merge pull request #4408 from santhoshkumar-dev/codex/agc-render-target-vertex-aliasing
fix(agc): exclude skipped vertex records from target alias checks
2026-10-13 16:29:52 +02:00
Adrià b0d41be1ff
Merge pull request #4283 from MarcZX100/codex/carry-guest-thread-stacks-3283
fix(libkernel): place Linux guest thread stacks inside application area
2026-10-13 16:28:18 +02:00
Adrià ef42c5f2af
Merge pull request #5183 from p3n1cillin/claude/carry-clock-settime
feat(libkernel): add clock_settime with FreeBSD argument checks
2026-10-13 16:27:05 +02:00
eljackjoestar-cmd 13818efc3b fix(agc): preserve array slice XOR in color target views 2026-10-13 16:25:05 +02:00
Adrià 146f171549
Merge pull request #4271 from eljackjoestar-cmd/codex/reclaim-source-ir
perf(shader): reclaim unreachable cached source IR values
2026-10-13 16:22:26 +02:00
Adrià 759c66564f
Merge pull request #4428 from hypermoist/perf/address-space-import-runs
perf(agc): keep adjacent ranges one import serves as one region of the cached address space
2026-10-13 16:18:14 +02:00
Adrià 5d7f1ffc1c
Merge pull request #4217 from Mouad-Scriptz-0/feat/videoout-mouse-capture
feat(libSceVideoOut): capture the host cursor for guest mice and scale their deltas
2026-10-13 16:15:45 +02:00
Adrià ac6d1b2013
Merge pull request #4163 from Celegans12/feat/agc-tessellation-patch-inputs
feat(agc): read hull patch constants in tessellation domain programs
2026-10-13 16:15:23 +02:00
codingreapermaps 3953a8d49e feat(libc): record traced import calls on Windows
TraceImport_nid_no_patch wraps a function of a library named in
APS5_TRACE_CALLS in a thunk that records the import, the thread and
the caller in a ring and counts the call, then jumps to the function.
One target keeps one thunk, so function pointers compare equal. The
crash and abort reports print the last 64 calls and the 32 most called
imports. Nothing calls TraceImport_nid_no_patch yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 16:13:12 +02:00
Adrià 8c772ad342
Merge pull request #4265 from fisherjoey/fix/fiber-host-stack
fix(libSceFiber): run fibers on host stacks with room for host calls
2026-10-13 16:12:14 +02:00
Adrià ab1755c258
Merge pull request #4459 from LeandroLP23/docs/contributing-gpus-tested
docs(contributing): ask GPU changes to name the GPUs their tests ran on
2026-10-13 16:11:54 +02:00
screamm 41b0ca597b feat(libkernel_sys): let chroot keep the guest root
Porpoise (PPSA99764) stops on its weak chroot import (#3632, #4497).
Run 5 on main c2565f014, and again on a copy of that runtime:

  FAIL: unresolved ELF import AKknh8Cx-V8 from libkernel_sys.prx

Its only call is in put_root_back (src/porpoise_jailbreak.cpp,
elripalda/Porpoise-Dolphin-Emulator-for-PS5 2ed1ab5a06995aa1): after a
jailbreak daemon has made the console's root its root and /app0 is
gone, it calls fchdir on the descriptor of "/" it opened at start, then
chroot("."), and checks the result. So it only ever puts back the root
it started in, and it does not use paths under any other root.

On top of the lookup errors of the previous commit, chroot now follows
FreeBSD 11.4 sys_chroot and pwd_chroot (8c639945, vfs_syscalls.c and
kern_descrip.c) for that case: a directory that is the guest root
("/", "/..", "." after fchdir to "/") succeeds without a change, since
fd_rdir would be set to the vnode it already is. The guest is taken
never to have changed its root, so with chroot_allow_open_directories 1
an open directory does not give EPERM. ENAMETOOLONG is added as in
pathconf, and a ".." through a file reports ENOTDIR instead of
escaping as a filesystem_error. Any other directory still throws: the
resolver's root and mount aliases are fixed, and no title is known that
needs a real new root.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-13 15:11:08 +01:00
screamm dc0d316fda feat(libkernel_sys): add chroot with FreeBSD lookup errors
Porpoise (PPSA99764) imports chroot (AKknh8Cx-V8) from
libkernel_sys.prx, not libkernel.prx, one reference. Predicted stop
once pathconf, the pthread_attr calls and ftrylockfile ahead of it are
covered (not a run):

  FAIL: unresolved ELF import AKknh8Cx-V8 from libkernel_sys.prx

The NID is computed with tools/nid_names.py and matches aerolib.

Follows FreeBSD 11.4 sys/kern/vfs_syscalls.c sys_chroot and change_dir
(8c639945a44588f6cfdddfb057bb5aad88735da0) for a root caller up to the
lookup: EFAULT for a null path, ENOENT for an empty or missing one,
ENOTDIR for a file or a path through a file. A directory that is found
throws with the path named: the resolver's root is fixed and the mount
aliases (/app0, /savedata0) are host paths that do not move with it,
so it cannot be re-based, and a real chroot is not modelled. Nothing
shows that Porpoise calls it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-13 15:11:08 +01:00
Adrià 91ed4ce625
Merge pull request #5174 from AkulTyagi11/feat/libc-implement-powidf2
feat(libc): implement __powidf2
2026-10-13 16:09:23 +02:00
Mouad-Scriptz-0 94087d08b0 feat(libSceVideoOut): capture the host cursor for guest mice and scale their deltas
The console's mouse reports relative motion, so the host cursor can never line
up with the cursor a title draws. While a title has a mouse open and the
window is focused the host cursor is hidden and captured, released on focus
loss or while the pad's mouse-to-stick toggle is on. Motion deltas are scaled
from the presented image's size in window units to the title's display
resolution with sub-pixel carry, so the title's cursor travels as far as the
host pointer would, on scaled desktops and letterboxed windows alike.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-13 14:05:52 +00:00
Adrià d0711248b1
Merge pull request #4279 from karanvora2599/fix/shader-coherent-gds
fix(shader): declare the GDS buffer coherent
2026-10-13 16:04:55 +02:00
Adrià Franch 745857448e test(libkernel): check the host-only stack guard on Linux only
Windows guest threads keep their normal stacks, so there is no host-only guard page below the guest stack to query.
2026-10-13 16:03:39 +02:00
MarcZX100 9b6e7f66c4 fix(libkernel): protect host-only guest stack pages 2026-10-13 16:03:36 +02:00
Cesar Rodriguez 7637cac13e fix(libkernel): place guest thread stacks inside the application area
On Linux, glibc maps the stack of every guest thread near the top of the
host address space (around 0x7fff00000000). On the console, application
stacks lie inside the application area below 0xFC00000000, and guest code
relies on that: ChakraCore's garbage collector indexes a 4 MiB table with
address >> 18, so it only covers addresses below 1 TiB and reports
Js::OutOfMemoryException for a stack above it.

Map each guest thread's stack with DoMapAnon, which allocates from the
guest arena, behind a PROT_NONE guard page, and pass it to pthread_attr_setstack.
The stack is freed after a join; the stack of a detached thread is freed once its
host thread is gone from /proc/self/task.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 16:03:36 +02:00
Adrià e0263e2b87
Merge pull request #5065 from MarcZX100/codex/cxa-thread-atexit
fix(libc): export __cxa_thread_atexit
2026-10-13 16:03:19 +02:00
nabilfp ae9978a98e feat(libkernel): add clock_settime with FreeBSD argument checks
PS5MC (PPSA99420, Kodi 22) imports clock_settime (d7nUj1LOdDU) from
libkernel.prx, one reference, after sigwaitinfo in its import order.
Predicted stop once the imports ahead of it are covered (not a run):

  FAIL: unresolved ELF import d7nUj1LOdDU from libkernel.prx

The NID is computed with tools/nid_names.py and matches aerolib.

Follows FreeBSD 11.4 sys/kern/kern_time.c sys_clock_settime and
kern_clock_settime (8c639945a44588f6cfdddfb057bb5aad88735da0) for a
root caller: EFAULT for a null time (copyin), EINVAL for any clock but
CLOCK_REALTIME and for a negative tv_sec or a tv_nsec outside 0 to
999999999. A valid CLOCK_REALTIME request throws with the requested
time named, since the host clock must not be set and no guest clock
offset is kept.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

Co-authored-by: David <david@example.com>
2026-10-13 14:57:46 +01:00
Mouad-Scriptz-0 326e0bc29f fix(agc): raise the graphics end-of-pipe event when a flip completes
A flip packet now delivers the queue's end-of-pipe event once the work
recorded before it completes, as a RELEASE_MEM with INT_SEL does. Minecraft
(PPSA17221) registers the graphics event, never requests an interrupt in its
releases, and waits on the event after every flip while holding its render
lock, so it presented one frame and then waited forever.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-13 15:49:45 +02:00
Adrià Franch 7a8e1b2559 docs(debt): restore UTF-8 characters corrupted in shader.md
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-13 15:48:15 +02:00
eljackjoestar-cmd 57b2dc8584 perf(shader): reclaim unreachable cached source IR values 2026-10-13 15:48:04 +02:00
Adrià e152ba8f69
Merge pull request #4209 from karanvora2599/fix/shader-cube-gradients
fix(shader): keep cube image gradients out of the face coordinate bias
2026-10-13 15:45:43 +02:00
Adrià 6cd052848a
Merge pull request #4210 from karanvora2599/fix/agc-depth-before-shader
fix(agc): test depth before pixel shaders that ask for it
2026-10-13 15:44:24 +02:00
Karan Vora 0998eb4f23 fix(shader): declare the GDS buffer coherent
GDS is one memory for the whole GPU on AMD hardware: every work-group's
ds_read and ds_write with gds see the others' writes, with no cache in
between. The recompiler keeps it in a storage buffer that was not decorated
Coherent, so on a GPU whose L1 caches storage buffer loads, NVIDIA's from
Turing on among them, a plain GDS read could return a value cached before
another work-group's GDS write. Atomics were not affected. The gds buffer is
now declared Coherent.

verifyCoherentGds in agc_shader_memory compiles a ds_read_b32 and a
ds_write_b32 on GDS and checks that the gds buffer is Coherent.
2026-10-13 15:43:31 +02:00
Adrià 2cf23fcc56
Merge pull request #4114 from Celegans12/fix/agc-tessellation-num-patches
fix(agc): bound tessellation patch records by the draw's patch count
2026-10-13 15:40:48 +02:00
Adrià 6c0f83c7cf
Merge pull request #4211 from karanvora2599/perf/shader-bindless-table-once
perf(shader): search a bindless image table once per access
2026-10-13 15:39:50 +02:00
Adrià Franch 36eb627051 fix(libSceFiber): throw when a fiber's host stack cannot be set up
No fallback to the title's context: a failed mmap or mprotect throws,
as on Windows.
2026-10-13 15:37:30 +02:00
fdfawef324 81364388a0 fix(libSceFiber): run fibers on host stacks on Windows
#4265 gives each fiber an mmap'd host stack on Linux and leaves Windows
as it was: there a fiber still runs host calls inside the context the
title passed to sceFiberInitialize. Demon's Souls packs its 16 KiB job
fiber contexts back to back. A job that calls
sceAgcCreateInterpolantMapping reaches shader preparation on the fiber
(Driver::ResolveShaderAbi, PrepareRegistered, the RDNA decoder,
BuildShaderStageInputInfo), goes more than 16 KiB deep and overwrites
the frames at the top of the context below it. On the loading screen
after the opening cinematic the fiber that owns that context then
failed the title's stack check, or returned to 0x7fffffff.

On Windows each fiber now gets a host stack from VirtualAlloc, the
context size plus 1 MiB, committed like the 1 MiB host margin of guest
threads, with a PAGE_NOACCESS page at the bottom. While the fiber runs,
the TIB stack base and limit and the deallocation stack describe that
host stack, as Windows does for its own fibers, so stack probes and
GetCurrentThreadStackLimits see the stack the fiber runs on. A host
stack that cannot be allocated, protected or released throws instead
of falling back to the context.

agc_driver_gpu_map_on_fiber: GetCurrentThreadStackLimits on a fiber now
returns its host stack, which has room for the import, so on Windows a
GPU mapping made on a fiber imports on the fiber's stack instead of a
host thread. The fiber's context is still not written.

Test: on Windows, fiber checks that the TIB stack bounds inside a fiber
cover its host stack, at least the context plus 256 KiB. With #4265
alone it fails at "the thread's stack bounds are the fiber's host
stack", and without that check at "a host call from a 16 KiB fiber
writes nothing below its context"; with this change fiber and
agc_driver_gpu_map_on_fiber pass (Windows Server 2025, RTX 3060,
WinLibs GCC 15.2.0, Release).

Demon's Souls (PPSA01342) on that host: at the loading screen the two
16 KiB job fibers above the overwritten one now use 17,592 and 16,936
bytes of their host stacks, the title's stack check no longer fails
there, and the load goes on until a separate Vulkan allocation failure
(vkAllocateMemory of a 4 MiB host-visible buffer, out of device memory).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 15:37:23 +02:00
Joey Fisher 794714983c fix(libSceFiber): run fibers on host stacks with room for host calls
Host code that a guest fiber calls runs on the fiber's stack. Demon's
Souls (PPSA01341) gives its job fibers 16 KiB contexts packed next to each
other, and a fiber that reaches shader preparation through
Driver::ResolveGraphicsStagesAbi goes about 21 KiB deep when SPIRV-Tools
validates the module. That overwrites the saved frame of the fiber below,
and the next switch to that fiber pops garbage into rbp, rbx, r12-r15 and
rip (a jump to 0x1a in the observed crash).

Fibers now run on an mmap'd host stack of the context size plus 1 MiB,
with a guard page at the bottom, the same margin guest threads get since
#2647. The guest context is no longer written. Context size checks fill
and scan the top context-size bytes of the host stack, so
size_context_margin keeps its meaning. If the mapping fails the fiber
runs in its context as before. Windows is unchanged: it pins and
publishes the guest context as the stack, and that path is not covered
here.

The fiber test now runs a 256 KiB host call from a 16 KiB fiber placed at
the top of a guard-filled area and checks nothing below the context was
written. It fails on main.
2026-10-13 15:37:23 +02:00
Adrià 58f7242ea2
Merge pull request #3934 from MarcZX100/codex/carry-setlocale-category
fix(libc): reject invalid setlocale categories
2026-10-13 15:35:56 +02:00