Commit Graph

2456 Commits

Author SHA1 Message Date
clem-gb 15c1962e82 fix(libkernel): keep ymm upper halves across a redirected raise
A thread that sceKernelRaiseException redirects resumes through
RtlRestoreContext with a CONTEXT that has no XSTATE, so the upper halves
of ymm0-ymm15 came back as the handler and the delivery path left them.
A handler or host routine that runs vzeroupper or any VEX instruction
(Zen 2 guest code, the CRT's memcpy) cleared the upper lanes of a thread
interrupted in the middle of AVX code. The entry stub now stores
ymm0-ymm15 next to the delivery when the CPU and the OS enable AVX, and
the exit loads them back right before RtlRestoreContext, which restores
only the low halves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HeC9bA3n74TzJRYv9AgBE8
2026-10-08 10:47:33 +02:00
Adrià a5df1a874d
Merge pull request #1177 from MichonGoddijn231849/feat/standard-64k-color-targets
feat(agc): 64 KiB standard color targets
2026-10-08 10:44:52 +02:00
Adrià 2c8c9634c3
Merge pull request #1176 from EdouardSence/fix/linux-anonymous-writable-image
fix(libc): back the main image's writable mappings with anonymous memory on Linux
2026-10-08 10:41:35 +02:00
Adrià 2959dc5318
Merge pull request #1168 from oguzhanozfe/fix/decoder-moffs-length
fix(relinker): decode the 64-bit address of MOV moffs instructions
2026-10-08 10:39:59 +02:00
Adrià 0e173a4634
Merge pull request #1143 from AchrafReyani/feat/libc-bad-weak-ptr
feat(libc): implement std::bad_weak_ptr and _Throw_bad_weak_ptr
2026-10-08 10:30:41 +02:00
Adrià 8388121a4f
Merge pull request #1153 from ebarr24/codex/windows-gui-error-status
fix(relinker): preserve GUI startup failure status without stderr
2026-10-08 10:26:56 +02:00
Adrià 17440abe24
Merge pull request #1165 from oguzhanozfe/fix/linux-dynstr-runpath-size
fix(relinker): include the run path in the Linux DT_STRSZ
2026-10-08 10:25:19 +02:00
Adrià 61896dea23
Merge pull request #1163 from oguzhanozfe/fix/decoder-rexw-immediate-size
fix(relinker): let REX.W override 0x66 when sizing decoder immediates
2026-10-08 10:23:35 +02:00
Adrià e705d430d6
Merge pull request #1139 from alfalfa-star/fix/agc-inert-pixel-stage
fix(agc): run draws whose pixel stage cannot run without its program
2026-10-08 10:20:09 +02:00
Adrià f6c33f0d04
Merge pull request #1131 from orbz22/feat/kernel-vectored-io-windows
feat(kernel): implement vectored file IO on Windows
2026-10-08 10:18:29 +02:00
Michon 6aa8e58de7 feat(agc): 64 KiB standard color targets
Color targets with the SW_64KB_S swizzle (CB_COLOR_ATTRIB3 tile mode 9) use the standard element
order of the 4 KiB mode extended by the texture detiler's 64 KiB bits, and are resident like the
other tiled targets. The standard blocks are now wider than tall for 2- and 8-byte elements, as the
standard swizzle and the texture layout have them (they were transposed, aliasing texels).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-08 10:16:22 +02:00
Adrià d549f76855
Merge pull request #1145 from AchrafReyani/refactor/name-resolved-unknown-stubs
refactor(libs): name the libc and Json2 stubs the NID database resolves
2026-10-08 10:16:20 +02:00
Adrià c081eb90dc
Merge pull request #1116 from Fishybeing/fix/libc-utf16-strings
fix(libc): read guest wide strings as 16-bit units
2026-10-08 10:15:55 +02:00
Adrià 8e22498c20
Merge pull request #1134 from alfalfa-star/fix/agc-mesh-unindexed-index-vsharp
fix(agc): bind a null index buffer to non-indexed mesh draws
2026-10-08 10:15:09 +02:00
Adrià 1c3f55628d
Merge pull request #1122 from TideOPL/feat/agc-copy-data-gpu-clock
feat(agc): copy the GPU clock counter with COPY_DATA
2026-10-08 10:12:18 +02:00
Adrià da4027399e
Merge pull request #1125 from TideOPL/feat/ppsa16064-missing-exports
feat(libs): add the unimplemented exports PPSA16064 imports
2026-10-08 10:01:59 +02:00
Achraf Reyani df570de6d5 feat(libc): implement std::bad_weak_ptr and _Throw_bad_weak_ptr
BnMAMrsfVWo is _ZSt19_Throw_bad_weak_ptrv. Replace the unknown stub
with a throw of a guest std::bad_weak_ptr, and add its type info,
vtable, destructors and what().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 10:00:54 +02:00
Adrià eaa6ccea08
Merge pull request #1124 from TideOPL/fix/agc-shader-fusion-swappc-terminator
fix(libSceAgc): accept s_swappc_b64 null, s[6:7] as a front half's terminator
2026-10-08 09:55:06 +02:00
Adrià f51eeff059
Merge pull request #1117 from TideOPL/fix/relinker-tls-unreached-code
fix(relinker): find Windows guest TLS accesses in code no root reaches
2026-10-08 09:54:40 +02:00
Adrià 7fccb7ff5f
Merge pull request #1051 from fisherjoey/fix/linux-unwritable-host-import
fix(agc): skip Linux host imports of ranges not mapped read-write
2026-10-08 09:53:40 +02:00
Raihan Abdul Majid 87f4444441 fix(kernel): transfer each iovec directly on Windows
Gathering every iovec into one host buffer threw for a total above
INT_MAX, which a console readv/writev accepts, and copied the whole
transfer twice. Each iovec is now read or written in place, in chunks
of at most INT_MAX bytes. A readv on a pipe returns after one read so
it does not block once the available bytes are consumed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UTjpbMX7BUFMZZaxJE98zV
2026-10-08 09:52:49 +02:00
Raihan Abdul Majid a38df0f020 feat(kernel): implement vectored file IO on Windows
sceKernelReadv, sceKernelWritev, sceKernelPreadv and sceKernelPwritev threw on Windows. They now gather or scatter through one host buffer and issue a single read or write, with the same argument checks and error codes as the Linux path. Positioned transfers restore the file offset afterwards, as pread and pwrite do on POSIX, and report ESPIPE for handles that are not disk files. guest_file_vector now runs on Windows as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UTjpbMX7BUFMZZaxJE98zV
2026-10-08 09:52:49 +02:00
Adrià Franch 1c523b370f test(agc): pin the 32-bit GPU clock COPY_DATA write
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-08 09:48:00 +02:00
TideOPL 23e0363e59 feat(agc): copy the GPU clock counter with COPY_DATA
COPY_DATA rejected source select 9 (GPU clock count) and any cache
policy bits. PPSA16064 (Minecraft Dungeons II, Unreal Engine)
calibrates its GPU timer at start-up with a submission of five
COPY_DATA packets, control 0x06016209: GPU clock source, memory
destination, 64-bit count, source and destination cache policy 3. The
submission was rejected and the title aborted.

The clock source now writes the same counter as a RELEASE_MEM
timestamp (the host steady clock in 10 ns ticks), read when the packet
runs, through the direct execute path and through ResolveStore for
stores recorded on the GPU. A 32-bit count writes its low half. The
source and destination cache policy fields are accepted and ignored,
as for WRITE_DATA and DMA_DATA. The reference clock (source select 10)
and the other unimplemented sources still throw.

agc_driver_pm4 runs the title's packet twice and checks a nonzero,
non-decreasing counter and an 8-byte resolved store, and that source
select 10 is still rejected.
2026-10-08 09:47:53 +02:00
Adrià 1e1e1390b5
Merge pull request #1123 from TideOPL/fix/agc-command-buffer-null-cursor-down
fix(libSceAgc): treat a null cursor_down as a buffer limited by its top
2026-10-08 09:41:38 +02:00
Adrià 8cb527165a
Merge pull request #1120 from TideOPL/feat/libc-sce-v2-runtime-symbols
feat(libc): export the __sce_v2 _Xbad_function_call and sized aligned delete
2026-10-08 09:40:20 +02:00
Adrià 72bcc33606
Merge pull request #1113 from Celegans12/fix/agc-batch-kept-bytes
fix(agc): bound the upload buffers that recorder batches keep alive
2026-10-08 09:39:56 +02:00
Fishybeing cd39c8db54 fix(libc): read guest wide strings as 16-bit units
The guest's wchar_t is 16 bits, but wcslen, wcscmp, wcsncmp, wcscpy, wcsncpy, wcschr, wcsrchr, wcsstr, wcspbrk, wcsspn and the wmem functions forwarded to the host's wchar_t functions, which use 32-bit units on Linux. Implement them on char16_t. The wide conversions that still use the host's wchar_t are listed in TechnicalDebt.
2026-10-08 09:39:55 +02:00
Joey Fisher 25c0a71869 fix(agc): skip Linux host imports of ranges not mapped read-write
NVIDIA (595.91.07) refuses VK_EXT_external_memory_host imports of
read-only or executable mappings with VK_ERROR_OUT_OF_DEVICE_MEMORY and
then fails every later vkAllocateMemory on the device. Check the range
is mapped read-write before importing on Linux, as the Windows path
already does for read-only memory, and copy it otherwise.

Refs #1022
2026-10-08 09:37:46 +02:00
Adrià 6b57386237
Merge pull request #1100 from gookie-dev/fix/agc-indirect-register-lists-at-submission
fix(agc): read indirect register lists when the command buffer is submitted
2026-10-08 09:14:02 +02:00
Dean 58a1bd6688
Merge pull request #1447 from oneandonlydean/fix/cmask-metablock-size
fix(agc): size CMASK by whole 1024x512 metablocks
2026-10-08 20:12:42 +13:00
Adrià 979ae68996
Merge pull request #1095 from kjhq/feat/libkernel-write-throttling
feat(libkernel): report no write throttling in sceKernelWriteThrottlingStatus
2026-10-08 09:11:51 +02:00
Dean 051d17dd59
Merge pull request #1329 from Dextroid17/fix/agc-nvidia-dmabuf-probe
fix(agc): keep dma-buf import off the NVIDIA proprietary driver
2026-10-08 20:09:19 +13:00
Dean a602045176
Merge pull request #493 from MichonGoddijn231849/perf/draw-key-user-words
perf(agc): draw cache keys on the user words each stage reads
2026-10-08 20:09:08 +13:00
Adrià f830fea754
Merge pull request #1094 from kjhq/feat/libkernel-mprotect
feat(libkernel): implement POSIX mprotect
2026-10-08 09:07:34 +02:00
Chad c17337b6d9 fix(agc): size CMASK by whole 1024x512 metablocks
A CMASK holds 4 KiB per 1024x512-pixel metablock, not one nibble per 8x8
tile of the target: 1920x1080 spans 0x6000 bytes, as titles clear it,
not 16200. The swizzled nibbles of the lower-right tiles lie past the
packed size, so the fast-clear check missed them and the expanded store
left them cleared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 19:53:02 +13:00
Adrià bc1fbe8158
Merge pull request #1110 from Sanjaysrinivas/fix/mspace-resize-overflow
fix(libc): reject overflowing mspace resizes
2026-10-08 08:46:42 +02:00
Adrià 5de0adf643
Merge pull request #1107 from Sanjaysrinivas/fix/libc-thread-safe-time
fix(libc): avoid time conversion races
2026-10-08 08:46:01 +02:00
Adrià f23e5c564e
Merge pull request #1105 from orbz22/fix/agc-guard-sources-path-regex
fix(agc): exclude tests and tools from the shader cache guard when the source path holds regex characters
2026-10-08 08:45:37 +02:00
Adrià 66b8abd8e6
Merge pull request #1101 from eliasbruno124-dev/fix/relinker-windows-guest-filenames
fix(relinker): resolve Windows guest filename casing
2026-10-08 08:43:35 +02:00
Adrià c3f4db777c
Merge pull request #1099 from winklemad/fix/sscanf-s-width-limited-fields
fix(libc): only fail sscanf_s fields when the buffer capped the width
2026-10-08 08:42:26 +02:00
Adrià 7ca179970c
Merge pull request #1437 from adriadam10/fix/unique-test-temp-paths
test: give fixed temp files a random suffix so parallel runs don't collide
2026-10-08 08:38:55 +02:00
Dean 66b9be6607
Merge pull request #1322 from TibixDev/pr/np-reachability-lifecycle
fix(npmanager): track reachability callback registration
2026-10-08 19:36:00 +13:00
Dean b31f1a92a3
Merge pull request #1427 from NahuelGenchi/work-pm4-failure-ctest
test(agc): run the PM4 asynchronous failure mode in ctest
2026-10-08 19:35:47 +13:00
Dean a57ccfb426
Merge pull request #1275 from KSWORK2001/fix/libscertc-dostime-range
fix(libSceRtc): answer out-of-range years in sceRtcGetDosTime
2026-10-08 19:35:43 +13:00
Dean 08766c4e71
Merge pull request #1251 from MGXAe/arena/a135bd3b-anyps5
fix(nid): reject libraries that define symbol versions
2026-10-08 19:35:39 +13:00
Adrià 56f3da20e8
Merge pull request #1072 from alfalfa-star/feat/agc-cmask-fast-clear
feat(agc): render into CMASK fast-clear color targets
2026-10-08 08:32:04 +02:00
Adrià Franch 25000541ad test: give fixed temp files a random suffix so parallel runs don't collide
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-08 08:31:16 +02:00
gookie de651c6283 fix(agc): read indirect register lists when the command buffer is submitted
The driver copies a submission's packets when it is submitted, but
SET_SH_REG_INDIRECT, SET_UCONFIG_REG_INDIRECT and SET_CONTEXT_REG_INDIRECT
read their (offset, value) lists from guest memory only when the queue
worker reaches the packet. A title that reuses its per-frame memory once
it expects the GPU to be done with it can rewrite a list in between, and
the worker then throws on the data it finds there ("extended register
semantics are not implemented (offset dword 0x3a888889)").

The lists are now read with the packets, after validation, in Submit and
for a rewind tail, and the worker writes the registers from that copy.
Pm4::Execute keeps reading the list itself for direct callers.

PPSA21402 (Balatro) keeps three frame slots and does not wait for the GPU
before reusing one: its slot labels start at 0xffffffff and the GPU only
ever writes 0xffffffff to them, so the poll before a slot is reused never
blocks. When the worker falls more than two frames behind, the title
writes per-draw constants over a SET_CONTEXT_REG_INDIRECT list the worker
has not read yet.

The console's PFP reads the list when it reaches the packet; the
difference is recorded in TechnicalDebt.md.
2026-10-08 08:30:22 +02:00
Adrià Franch 53a31b512e test(guest_memory): pin mprotect on an unmapped and a wrapping range
Both return -1/EINVAL: FreeBSD kern_mprotect (sys/vm/vm_mmap.c) maps only
PROTECTION_FAILURE, RESOURCE_SHORTAGE and OUT_OF_BOUNDS to their own errno, so
KERN_INVALID_ADDRESS falls to EINVAL.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-08 08:24:12 +02:00