* fix(agc): write back BDA stores into writable heap mirrors
* fix(agc): note only the stored runs of address-store spans as written back
* perf(agc): compare only the pages BDA stores hit in heap mirror spans
* perf(agc): copy heap mirror write-back references on the GPU
* feat(shader): redirect BDA stores into unbound heap mirror blocks to store pages
* fix(agc): store into resident heap mirrors without binding, copying or reading back the span
* fix(agc): write back copy-backed heap mirrors by per-byte store masks
* perf(agc): reuse store page pools across address-based builds
* fix(agc): write back stores into unbound heap mirror blocks by their store masks
* test(agc): pin store page exhaustion of heap mirror stores at the pool size
* test(agc): store to 1,025 heap mirror pages against the default store page pool
* fix(agc): race the journal replay against a journal that holds every raced pipeline
* test(agc): size the journal watermark case's records from the rewrite target
* test(agc): expect copy-backed heap mirror stores as production masks and reports them
* test(agc): check that an over-limit store page dispatch writes nothing, without pinning its refusal
* docs(debt): state what a use past the BDA store page pool gets
* test(agc): check a build's private fault slot leaves the arena with it
* fix(agc): build the store-page overflow message only on overflow
* fix(agc): reuse the merged writes without address stores
* feat(libSceNKWebKit): implement the WebCore::SecurityOriginData fromFrame and isolatedCopy exports
* fix(libSceNKWebKit): start the tuple lifetime in the null-frame SecurityOriginData
* docs(debt): state that the SecurityOriginData return convention is fixed by the ABI
Co-authored-by: Dean <158058829+oneandonlydean@users.noreply.github.com>
* feat(libSceLibreSsl3): print an X509 certificate
* docs(libSceLibreSsl3): keep the X509_print debt bullet under the length limit
* fix(libSceLibreSsl3): print a serial of minus one in decimal and hexadecimal
* feat(libc): implement hcreate, hsearch and hdestroy
* fix(libc): register the guest_hash_search test by fragment
* fix(libc): size the hsearch table for a low load factor
* perf(libc): compare the stored hash before copying a hsearch key
* test(libc): cover the 16-slot minimum of hcreate
Give the test callbacks the UserUcontext* parameter libkernel calls them
with, bound the pending-timer loop as the other waits in the file are,
and describe the sigsuspend null set and the per-thread mask in the
debt entry as the code behaves.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(agc): delist a discarded batch's copied writers
* fix(agc): restore occlusion samples a discarded batch folded and drop its own
* fix(agc): refuse native depth sampling after a discarded HTILE clear
* fix(agc): latch a deferred completion's submit failure before waking idle waiters
* fix(agc): keep discard actions exception-safe from registration to run
* test(agc): restore samples a discarded batch folded from queued dumps or at capacity
* test(agc): check a discarded HTILE clear dispatch is undone on every host
* test(agc): show a deferred completion latches its failure before waking idle waiters
* test(agc): fail a discarded HTILE clear dispatch only on its own batch
* fix(agc): undo only a discarded batch's own HTILE clear dispatches
* feat(libScePosixForWebKit): implement mkstemps
* fix(libScePosixForWebKit): apply the FreeBSD mkstemps suffix bounds
* fix(libScePosixForWebKit): restore the mkstemps test block after the merge
* test(libScePosixForWebKit): reject unreplaced X characters in mkstemps names
* test(libc): check the exception ABI entry points that no test called
* test(libc): run the exception throw helper checks on Linux only
* test(libc): leave the throw helpers and std::uncaught_exceptions to the open tests that check them
raise, kill, pthread_kill, pause, sigsuspend and unblocking a pending
signal now call an SA_SIGINFO handler as handler(sig, info, uc) instead
of throwing. info is the 80-byte siginfo_t sigtimedwait already fills
(SI_LWP, SI_USER or the queued code such as SI_TIMER). uc is captured
with getcontext at the delivery point and carries the mask from before
the delivery; under sigsuspend that is the mask sigsuspend replaced plus
the blocks of an outer handler, as FreeBSD's td_oldsigmask. A changed
uc_sigmask becomes the mask on return, as FreeBSD 11's sendsig and
sys_sigreturn do. A changed uc_mcontext that switches to another context
is resumed through sigreturn after the handler's blocks are released;
one that keeps the %rip or %rsp of the delivery point throws, since
those registers are libkernel's and not the system call's. sigsuspend
puts its previous mask back when a delivery throws. A host signal still
does not reach an SA_SIGINFO handler; the debt entries say so.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This reverts commit 11062d5d7d, reversing changes made to 9931d320d9.
ngs2_core_routing fails on main since it landed: the forward natural-order output and the inverse path no longer match the existing Ngs2Routing test.
* feat(libSceLibreSsl3): implement SSL_CTX_add0_chain_cert and SSL_CTX_clear_chain_certs
* fix(libSceLibreSsl3): detach extraCerts before certificate release in SSL_CTX_clear_chain_certs
* fix(libSceMsgDialog): probe guest message parameters
* docs(libSceMsgDialog): move guest parser debt into change fragment
* fix(libSceMsgDialog): use PRX unwind for parser test
* fix(libSceMsgDialog): accept short text at guarded page end
* fix(libSceMsgDialog): fail closed on unsupported host reads
* fix(libSceMsgDialog): fail closed on checked read exceptions
* fix(libSceNetCtl): guard sceNetCtlGetResultV6 against uninitialized calls
* test(libSceNetCtl): call sceNetCtlGetResultV6 with a valid event type
* fix(libSceNetCtl): avoid clobbering output before throw in sceNetCtlGetResult and preserve errno
* test(libSceNetCtl): fix ClobberWriteErrno hook callback signature
Co-authored-by: Dean <158058829+oneandonlydean@users.noreply.github.com>
* feat(libfontconfig): implement FcFontRenderPrepare
* fix(libfontconfig): keep a font value when every match score is NaN
* docs(libfontconfig): move the debt changes to a fragment
The Unknown function info entry still said rfork_thread and sceKernelRdup
both throw. #24240 implemented sceKernelRdup for the caller's pid and gave
it its own entry; rfork_thread still throws.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 13.60 measurement entry for sceCameraInitializeRegistryCalibData and
sceCameraSetCalibData replaced the placeholder, but the old entry saying
it throws through NotImplemented_nid_no_patch stayed. The function
returns SCE_CAMERA_ERROR_NOT_INIT.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
feat-parser-finalize.md still said the JPEG and GvMp4 Initialize exports
were unbound, so Finalize never had a context to free. Both are bound now
and their Finalize frees the context through the copied allocator table.
The JPEG entry also links Thumbnail.cpp, where Finalize lives now.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two fragments both changed the sceRudpProcessEvents, sceRudpNetFlush and
sceRudpNetReceived entry after #25988, so debt_fold --check failed on main.
The internal I/O thread fragment now carries the whole entry, including
the write and read result and the PPSA03490 call pattern.
* fix(avplayer): use precise waits for video buffer recycling
* test(avplayer): check video buffer wait accuracy
* fix(avplayer): export wait observer on ELF hosts
* feat(relinker): route ps5-payload-dev pathconf stub to libkernel export
* feat(relinker): route ps5-payload-dev pathconf stub in bundled guest modules
* feat(relinker): restrict pathconf route candidates to zero-addend function pointers
* refactor(relinker): share the pathconf import matchers between main and guest routes
* fix(relinker): drop the ordinary trap mirror into the NID filter text copy
* test(relinker): cover game patches overlapping the routed pathconf stub
* feat(libSceIcu): implement the uhash hash table exports
* docs(libSceIcu): carry the ICU notices of uhash_us.cpp, ustring.cpp and uhash.h in HashTable.cpp
* fix(libSceIcu): rename the guest deleter alias so it does not clash with ICU's UObjectDeleter
Co-authored-by: pr-review4 <pr-review4@users.noreply.github.com>
Co-authored-by: Dean <158058829+oneandonlydean@users.noreply.github.com>
A name that carries a line ending or other whitespace matches no export, so the lookup answered 'no matching PS5 export' and 'no matching PS5 export changes' for it, which reads as nobody working on the function. Names read from a CRLF file through command substitution arrive this way. The lookup now stops before any request and lists the arguments.
* fix(libSceLibreSsl3): re-land the ASN.1 and EC guest pointer copies without the Windows failures
* fix(libSceLibreSsl3): read d2i_ASN1_INTEGER content from guest memory in 64 KiB chunks
* fix(libSceLibreSsl3): refuse EC DER lengths the guest copy cannot take and follow the private naming rule
* fix(libSceLibreSsl3): refuse EC DER ranges that wrap the address space and keep the cursor on failed decodes
* fix(libSceLibreSsl3): refuse a guest range that wraps the address space in the ASN.1 input reader
* fix(libSceLibreSsl3): bound EC input copies and probe guest writes before changing state
* fix(libSceLibreSsl3): keep the caller's EC key and ASN.1 outputs unchanged when a decode fails
* fix(libSceLibreSsl3): stage caller-visible changes of the ASN.1 and EC decoders until the input has been validated
* fix(libSceLibreSsl3): read only the bytes an EC parameters encoding needs and fix the debt fragment
* fix(libSceLibreSsl3): reset a released ASN.1 integer before freeing it
* test(libSceLibreSsl3): cover d2i_ECParameters with caller pointers that cannot be written
* fix(libSceLibreSsl3): advance the o2i_ECPublicKey cursor by the bytes it validated
* refactor(libSceLibreSsl3): return the decoded EC group as an owning pointer
* fix(libSceLibreSsl3): write the d2i_ECParameters cursor last so a faulting write leaves it unchanged
* fix(libSceLibreSsl3): write the d2i_ASN1_INTEGER cursor last so a faulting write leaves it unchanged
* fix(libSceLibreSsl3): report a failed restore of a caller slot instead of ignoring it
* fix(libSceLibreSsl3): check the EC point and key allocations before using them
* fix(libSceLibreSsl3): check the DER length limit before multiplying so an oversized length field cannot overflow
* fix(libSceLibreSsl3): return a malloc error for a failed staging buffer, preflight outputs without reading them, stop the EC length scan at an invalid header
* test(libSceLibreSsl3): drop the allocation hook that cannot reach the library and note the unexercised path
* test(libressl3): cover unwritable cursor in ASN1_get_object; link upstream commits in licence headers
* docs(libressl3): name the derived LibreSSL commit and the pinned licence commit in IntegerDecoder.cpp
* fix(libc): ignore the scan lengths the bundled libc.prx ignores
* fix(libc): store a float for wide floating scans with other lengths
* test(libc): cover ignored scan lengths through plain sscanf and vsscanf
* docs(libc): end the scan length debt sentence and split a test line
Co-authored-by: Dean Galvin <dean.galvin@live.com>
The host never connects, so the calls that wait for connection state 2 keep returning 0x810E0004, and 6egMR0eB8RU keeps returning 1.
Co-authored-by: Cursor <cursoragent@cursor.com>
* perf(shader): keep specialized SPIR-V in the shader disk cache
* fix(shader): key specialized SPIR-V on recompiler switches and image offsets
* fix(shader): key specialized SPIR-V on vertex patches and stencil references
* perf(agc): keep a reused image table's cache entries while none was erased
* test(agc): let the entry memo test reuse the table before it counts memo hits
* feat(libkernel): share a ksem semaphore across dup, dup2 and F_DUPFD, as FreeBSD 11.4 does
* fix(libkernel): keep IsKsemDescriptor for the callers outside Stdio.cpp
* fix(libkernel): stat and chmod a destroyed ksem through its other descriptors
* fix(libkernel): recheck a ksem's dead mark under its lock
* test(libc): pin fpurge keeping the logical read position and the pushback as measured on the console
* fix(libc): fpurge keeps the logical read position and the pushed-back bytes as the console does
* docs(debt): state the console result for fpurge and what it left open
* fix(libSceAgc): write the console's pop marker tag
* test(libSceAgcDriver): recalibrate job manager compute pins for the console pop marker tag
Co-authored-by: MauriceSirius <MauriceSirius@users.noreply.github.com>
The debt file still said the Set*EventAsync entry points read the event
record in place and crash on a partially mapped record, but #19627 moved
validation to guest copies. Nothing tested that case beyond pointer 0x10.
The new check ends the readable bytes inside the inline entry name at
+0xD0: a name terminated just before the guard page is accepted, and one
running into it returns 0x818C0002 without writing the status or
changing errno. The guard page setup of the timestamp check is shared.
The debt fragment removes the stale entry and records the coverage.
AI-assisted: yes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sceCesSJisToUtf8 answers INVALID_PROFILE for a null profile and clears both
lengths for a null profile or a null source. sceCesSJisCodeToJisX0208 zeroes ku
and ten on failure and answers UNSUPPORTED_CODE for 0x0020. sceCesJisX0208ToSJisCode
answers 0x805C0015 and zeroes the code for the measured cells (0, 1), (1, 0),
(1, 95) and (93, 95) and stores 0xF040 for (95, 1); other cells are unchanged.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Amend the existing feat-opus-encoder-ctl fragment (no second fragment): a PS5
(firmware 11.60, payload process; a title process may differ) rejected a
zero-filled 512 byte state with 0x813F0016 (Celt) and 0x81770015 (Silk) for
-1, 4000 to 4003, 4028 and 4031, and a null state with 0x813F0001 and
0x81770001, writing nothing; sceOpusSilkEncCancel with a zero-filled state
returned 0x80930001 with errno 49 where this throws. Prototypes assumed, n=1,
not a real encoder state; request values and GET writes against a valid state
stay unmeasured.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Pins what the console wrote in two identical runs of libSceCesCs_sjis_eucjp
(payload process, firmware 11.60, cases g.4, g.5, f.3, f.5, f.9, f.10, f.11,
f.12, f.14): sceCesSJisToUtf8 with a NULL profile answers INVALID_PROFILE and
clears the length outputs, with a NULL source it clears them too, the JIS X 0208
helpers zero their outputs on failure, 0x0020 answers UNSUPPORTED_CODE, and the
measured out-of-range cells answer 0x805C0015 (the single (95, 1) point also
stores 0xF040).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* feat(libSceLibreSsl3): implement d2i_ASN1_SEQUENCE_ANY
* docs(libSceLibreSsl3): count the additional exports once and drop resurrected rows after merging main
Co-authored-by: pr-review3 <pr-review3@ps5team>
* feat(libkernel): implement execl, execle and execlp
* fix(libkernel): throw NotImplemented for execl, execle and execlp on Windows
* fix(libkernel): read execl, execle and execlp arguments in place and implement them on Windows
* test(libkernel): cover execl arguments past the register slots
* chore: rerun the checks
* test(libSceAudioOut): pin the console answer of sceAudioOut2ContextSetAttributes for a null attribute list
* fix(libSceAudioOut): refuse a null attribute list in sceAudioOut2ContextSetAttributes with the console code
* docs(libSceAudioOut): record the sceAudioOut2ContextSetAttributes measurement
* test(libSceAudioOut): expect the console answer for a null attribute list in the device state and timing tests
* feat(sysmodule): answer IsCameraPreloaded and forward UnloadModuleByNameInternal
* test(sysmodule): check IsCameraPreloaded with the by-name rows, clear of #18184
* test(sysmodule): keep main's final unload row so the test merges with #18184
* refactor(sysmodule): move the libkernel_sys include clear of #27111's hunk
* feat(padtracker): answer Init, Term, Calibrate and ReadState from the firmware checks
* test(padtracker): align the working memory at run time so the test builds on Windows
libkernel_web forwarded __sceKernelGetGPI to the libkernel_sys export of
the same NID, which it also exports, so patched_self_imports failed on main
since #26609. Call sceKernelGetGPI, which the libkernel_sys export returns.
* feat(libSceLibcInternal): implement std::exception::_Set_raise_handler
* docs(libSceLibcInternal): drop the older ctype bullet that main replaced after the facet-table fix
Co-authored-by: pr-review3 <pr-review3@ps5team>
ftw called libc opendir, readdir and closedir, whose NIDs this library
also exports, so patched_self_imports failed on main since #26505. Use the
internal directory helpers, as the other walker in this library does.
* fix(libSceAppContent): preserve ownership of shared add-on mount aliases
* test(libSceAppContent): cover ASCII case folding in mount alias collision
* test(libSceAppContent): remount the trailing-slash alias after the case-folded one
* feat(libkernel_sys): notify aio completions by signal or kevent and queue aio on sockets
* fix(libkernel_sys): take back an aio completion signal on free and finish cancelled socket requests
* docs(debt): name the SIGPIPE target in the aio entry
* test(libkernel_sys): fill the socket before the partial-write cancel check
* docs(debt): fold the aio_suspend EFAULT fragment into the aio entry
* test(libkernel_sys): drain the filled socket before checking a partial aio write
* test(libkernel_sys): let partial socket writes pass on hosts that take a whole write at once
* fix(libkernel): rebind an existing aio knote to the new request
Co-authored-by: Dean Galvin <dean.galvin@live.com>
The setting hints sat inside the label that wraps each field, so screen
readers announced the range and built-in value as part of the field
name and again as its description. Name each field by its setting name
with aria-labelledby, keeping the hint and help text as description.
MouseSensitivity accepts values above 0 but its hint read 0–10. Replace
its special case with a generic exclusive minimum, used both by the
validation and by the hint, which now reads 0 < x ≤ 10. The error
message is unchanged.
Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AI-assisted: yes
* feat(libScePosixForWebKit): implement ftw
* fix(libScePosixForWebKit): end ftw with ELOOP on a directory cycle
* docs(libScePosixForWebKit): describe the ftw cycle result
* fix(libScePosixForWebKit): report ftw directory read and close errors
* feat(libc): implement tsearch, tfind, tdelete and twalk
* fix(libc): register the tree search test by fragment
* fix(libc): return null from tsearch, tfind and tdelete for a null rootp
* test(libc): check twalk levels and the tdelete parent slot
* chore: rerun the checks
* test(libc): check that tdelete returns the parent slot two levels down
The input settings editor listed only the setting names, with every
field blank. Nothing told the user which values are accepted or what
AnyPS5 uses when a field is left blank, so the only feedback was the
error after typing an out-of-range value.
Each setting now shows its accepted range and its built-in value under
the field, linked to it with aria-describedby. The built-in label reuses
the existing translated "builtin" string, so no locale needs new keys.
The range is isolated from the text direction so it reads the same in
right-to-left locales. A test checks the built-in values against the
native InputSettings defaults.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AI-assisted: yes
On a PS5 (firmware 13.00) image_load through a 2D T# with TYPE=0 and any
nonzero bit in dwords 0-3 left the destination registers unchanged, dwords 0-3
all zero returned zeros, an unset format or an all-ones T# returned zeros, and
TYPE=1 faulted the GPU. The debt entry said gfx1013 was unverified; the
implementation still returns zeros in both cases.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The unversioned entry, given the same geometry halves as sceAgcFuseShaderHalves_0200 and its own register memory, returns 0 and a GS whose code and size are the _0200 result's, with the fused register list copied into the caller's memory and equal to the _0200 list.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The French labels of the input settings and controller button editors
used "saisie", which the French locale writes "entrée" elsewhere, and
"Paramètres", already the name of the application settings menu. The
infinitive "Hériter" also read as an action rather than as the value
that applies when a field is left blank. Use "Réglages d’entrée",
"Valeur héritée" and "Affectation héritée", and describe the blank
field as keeping the inherited value.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AI-assisted: yes
After sceImeBackendModeCaretPrevious moves the caret from 3 to 2 in "HiA", sceImeBackendModeCaretNext returns 0 and sceImeBackendGetCaretIndex reads 3 again; a second sceImeBackendModeCaretPrevious brings it back to 2 so the rest of the editing checks run unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Report `if (out) *out = 0;` and `(long long)*value`, and leave an operand
followed by `->` or `[` out of the dereference kind.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Write the document from its root element through the existing reader,
with the module's closing-tag, comment and reference quirks, and keep
the result in the Document until the next serialize.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Linux and macOS clock_gettime ids 1 and 2, and id 21 built on id 2,
came from times(), which counts in _SC_CLK_TCK ticks (usually 10 ms),
and threw when times() failed. They now read getrusage(RUSAGE_SELF)
ru_utime and ru_stime in microseconds and set the guest errno on
failure, as FreeBSD 11.4 kern_clock_gettime does through calcru and
TIMEVAL_TO_TIMESPEC.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
_reclaim_telldir takes FreeBSD 11.4's void _reclaim_telldir(DIR*) from
lib/libc/gen/telldir.c, which frees the stream's ddloc records. telldir
here returns raw positions and keeps no records, so a valid stream is
left as it is and a null stream sets EBADF, as telldir and seekdir do.
The stub moves from InventoryExports6.cpp to Directory.cpp beside
_seekdir, and guest_opendir2 checks both cases.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A console probe (firmware 13.00) shows the PCM record is read when attribute 4
is set: changing the buffer afterwards does not reach the output, and a render
without a new PCM attribute reads silence instead of the buffer again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
libyuv's fixed-point scaler shifts the source dimension by 16 and adds the step in an int. A 32768 pixel dimension overflows that arithmetic. Reject 32768 and keep 32767 as the largest accepted crop, and move the boundary tests to it.
The persistence decoder allocated charactersOffset + byteLength bytes and then placement-newed a StringImpl over them. StringImpl is 24 bytes, so a 1-3 byte string left 1-3 bytes of the object past the allocation. Allocate at least sizeof(StringImpl), as the NKWebKit string builder already does.
* fix(libSceNgs2.native): fill the rack info header through a guest copy in sceNgs2RackGetInfo
* test(libSceNgs2.native): cover the rack info header output in sceNgs2RackGetInfo
* fix(libSceNgs2.native): write the custom rack info extension through a guest copy in sceNgs2RackGetInfo
* test(libSceNgs2.native): cover an unwritable custom rack info tail in sceNgs2RackGetInfo
sceUsbStorageGetMountPointOfShellCore refuses a null mount point with
SCE_USBSTORAGE_ERROR_INVALID_ARGUMENT and an absent device with
SCE_USBSTORAGE_ERROR_DEVICE_NOT_FOUND, but no test read either answer.
The suite now covers both, and checks that the absent-device path
leaves the guest buffer untouched. These are AnyPS5 host-safety
answers, not behaviour measured on a 13.42 console.
AI-assisted: yes (FreeBuff). Adds the missing shell-core mount point guard cases to guest_usb_storage.
Generate the six material band filters from sine crossovers on a 1024-point
grid under a Hamming window instead of a recovered table, erase render state
on system destroy and material unregister, and throw on portal paths,
unreadable PCM, non-finite source distances and delays beyond the history.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The entry said what the native query reads was not measured. A payload process
on a PS5 (firmware 11.60) returned 0 in ten calls, five in the main thread and
five in a second thread. What the query returns while a sanitizer is active,
and in a title process, stays unmeasured. The change goes into the fragment
that already targets this entry, as the fragment check allows one per entry.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A payload process on a PS5 (firmware 11.60) returned 0 in ten calls of
sceKernelIsAddressSanitizerEnabled, five in the main thread and five in a
second thread. No test pinned the return value. The test is green from the
start; it keeps the measured value from changing unnoticed.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The [epoch-proofs] line (resource proofs reused and made by the draw finisher's epoch proofs) was printed only with APS5_PROFILE_DRAW or APS5_VERIFY_DRAW_PIPELINE. The first finishes every draw on the reading thread and the second runs the full checks, so neither shows the counts of a normal run. Print the line with APS5_PIPELINE_STATS as well. No behaviour changes without the switch.
* fix(libSceVideoOut): return the firmware's codes from the other event pairs
* test(libSceVideoOut): expect the firmware codes in #15902's other event rows
* fix(shader): translate v_sin_f32 and v_cos_f32 in f32 denormal modes 1 and 2
* test(shader): allow one ulp on host sin and cos results in the f32 denormal mode test
* docs(shader): move the sin and cos debt change to a fragment and drop a test comment
The default Pair constructor used to destroy the key it had built when
constructing the value threw; the guest-pointer rework dropped that
rollback. Restore it, and give the keyed constructor the same rollback
around copying the value.
A bare arm such as 'APS5_NO_GUARD_SPANS + APS5_NO_OWNED_DRAW_INPUTS'
parsed its switches with the spaces trimmed but kept the raw token as
its name, so the phase markers printed a name with spaces that
tools/ab_split.py's PHASE pattern does not accept. Join the parsed
switch names with '+' instead, and cover the spaced form.
Follows the firmware 9.20 reading on #25863. GetProgress reports idle
and ended sessions by caller SDK, ValidateContents and the title-id list
and data-with-thumbnail exports run their checks before the service.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
qsort_r now returns before validating its arguments when the count is
below two, or the element size is zero with fewer than 7 elements: FreeBSD
11 qsort.c's insertion-sort branch then never calls the comparator or
reads the array. A zero element size with 7 or more elements still throws,
where FreeBSD's partition loop never ends, and a null comparator or base
with two or more elements still throws. The debt entry records both.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
getrusage(RUSAGE_CHILDREN) on Linux and macOS returned an all-zero
rusage. It now returns the host getrusage(RUSAGE_CHILDREN), which holds
the children reaped by wait4, as FreeBSD 11.4 kern_getrusage returns
p_cru. ru_maxrss on macOS is converted from bytes to kilobytes, the unit
of FreeBSD getrusage(2), for getrusage and wait4 usage. On Windows
RUSAGE_SELF and RUSAGE_THREAD report ru_maxrss from the peak working set.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Covers a 5-byte and a 9-byte DER length, a SET instead of a SEQUENCE,
an empty SEQUENCE, an end-of-contents field, trailing data, a NULL,
SEQUENCE and object parameter that the X509_SIG decode rejects, and a
SEQUENCE parameter it accepts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RSA_verify decodes the X509_SIG through a mirror of LibreSSL 2.5.4's
tasn_dec.c template decoder for X509_SIG and X509_ALGOR, so a rejected
DigestInfo queues the library 13 reasons and the nested errors in
LibreSSL's order. DER lengths are read as 64-bit values, as the LP64
library reads them. The Wycheproof test now compares every queued code.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Read the pinned ICU GraphemeBreakTest data. Exercise both exported WebKit helpers for every sequence and verify every expected boundary as a UTF-16 code-unit offset, including supplementary characters.
AI-assisted: Codex + GPT-6.2 Astra (xhigh)
Start the steady-clock deadline when the first replacement worker is launched. Reuse it for the remaining ports in that guest output call so simultaneous missing devices cannot accumulate a 100 ms wait apiece.
AI-assisted: Codex + GPT-6.2 Astra (xhigh)
Open sixteen virtual ports, bring the endpoint back, and hold all replacement device opens until the guest batch returns. Allow one second for the 100 ms recovery budget and check each port launches one attempt.
AI-assisted: Codex + GPT-6.2 Astra (xhigh)
Leave encodings below 0x8000 unchanged. For negative half encodings, subtract the bits from 0x7fff to produce signed keys from -1 to -32768. Applying the same reflection to the selected key recovers all sixteen original bits.
AI-assisted: Codex + GPT-6.2 Astra (xhigh)
sceAudioPropagationSourceRender adds a path's first-order ambisonic
contribution for format 0, 1024-sample frames and float or int16 PCM,
following impulse responses measured on a console's own module
(firmware 13.00, sceKernelGetSystemSwVersion 13.590.001): delay, OpenAL
rolloff and cone, gains, ACN/SN3D axes, the measured material band
filters and a one-frame ramp. Other active paths still throw.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every title I run calls sceKernelGetProcParam, and no test called it.
Install a process parameter block with ProcessParametersFixture, as the
other process-parameter tests do, and check that sceKernelGetProcParam
returns that block, the same one on a second call.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sceAudioOutOutput and sceAudioOutOutputs reopen a port's host device
when SDL has stopped it, and retry every 2 s when the port has none.
They did so on the guest thread, holding the global AudioOut mutex.
When no PipeWire server is reachable, every open fails, so a port
repeats the failing open every 2 s, and one of those opens blocked in
pw_thread_loop_stop inside SDL's ALSA open. While it does, the calling
guest thread stops, and so does every other port's output, because each
waits on the same mutex.
Open the replacement device on a host thread instead. The guest thread
releases the mutex and waits up to 100 ms. An open that returns in time
is installed before the call goes on, as before. Otherwise the port
keeps its timed virtual output until the open returns.
The host thread installs the device only if the port is still the one
it opened for; each sceAudioOutOpen gives the port a new generation. If
the port changed, the host thread closes the device. A port starts no
other open while one is in flight, and the stopped device is closed on
the host thread too. Vibration ports keep the synchronous path.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The non-NaN median of v_med3_f16 was built from four nested minMaxF16Bits
calls. Each outer call re-derived the sign-magnitude order key of an
intermediate select, which value numbering cannot share. Compute the three
operand keys once, take the median with SMin/SMax on the keys, and map the
median key back with the same involution masked to 16 bits. The order is
a bijection on 16-bit patterns, so the selected bits are identical, -0
still sorts below +0, and the NaN path is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A ksem id is backed by a host null device descriptor here, so read
returned 0, write the length, and lseek and pread 0. FreeBSD 11.4's
ksem_ops reads and writes through invfo_rdwr, which fails with
EOPNOTSUPP after dofileread finishes a zero-length read with 0, and
lacks DFLAG_SEEKABLE, so lseek, pread, pwrite and their vector forms
fail with ESPIPE. kern_lseek answers ESPIPE before fo_seek looks at
whence, so lseek on a ksem id no longer checks whence first. A ksem id
now answers these as a kqueue already does, and a null buffer no
longer turns the read or write into EFAULT.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
guest_np_common_runtime checked the global heap allocator through
sceNpGlobalHeapGetAllocator, sceNpGlobalHeapGetAllocatorEx and
sceNpGlobalHeapGetAllocatorExPtr, but no test called
sceNpGlobalHeapGetAllocatorPtr or sceNpGetRandom.
Check that sceNpGlobalHeapGetAllocatorPtr returns the global heap
allocator, with the same context and allocate function as the Ex
pointer, and that it allocates and frees. Check that 16 sceNpGetRandom
calls do not all return the same value.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
guest_http_options builds every connection and request with
sceHttpCreateConnectionWithURL and sceHttpCreateRequestWithURL, so no
test called sceHttpCreateConnection, sceHttpCreateRequest or
sceHttpCreateRequestWithURL2. Four of the titles I run import
sceHttpCreateRequestWithURL2.
Build a connection and two requests with them from a template that has
authentication and a raw cookie value set. Check that each gets a new
id and takes its parent's options, and that changing one request leaves
its sibling and its connection as they were.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two APS5_TRACE_SUMMARY_EVERY rows of separate runs never start at the same present, so performance_compare reported window.first_present as a configuration difference and the labels check kept 'perf numbers missing' on a pull request that pasted both rows. Rows with the spec 'summary_every N' are now compared like 'seconds A:B' windows: the spec must match, the counter is not configuration. Any other spec keeps the counter check.
* test(libc): test __cxa_rethrow and dependent exceptions
* test(libc): test exception_ptr refcount and lifetime
* test(libc): test _Doraise and system_error copy
* feat(agc): group GPU draw timings by complete shader stage sets
* test(agc): include stage timing keys in the default build
* test(agc): check stage grouping through recorded draws
* feat(libScePosixForWebKit): implement mkdtemp and getpwnam
* fix(libScePosixForWebKit): copy the getpwnam name through the guest helper
* fix(libScePosixForWebKit): give mkdtemp the mkstemp template rules
* feat(libc): implement the double complex trigonometric, exponential and power functions
* fix(libc): register the guest_complex_trig test by fragment
* test(libc): cover casinh, catanh and a signed zero in the complex trig test
* style(libc): remove a doubled blank line in FloatBuiltins.cpp
* fix(libc): restore the complex double functions cut off by the merge
* chore: rerun the Windows changed-tests job
A PS5 payload process on firmware 11.60 ran FT_List_Add, Insert, Find,
Remove, Up, Iterate and Finalize of libSceFreeTypeOt.sprx on its own list,
nodes and callbacks (run 2026-11-25T040604Z): the order of the nodes, the
Find results, the callback order and result of Iterate and the destroy and
free calls of Finalize equal what AnyPS5 does. The entry now says that
and keeps the cases that were not measured.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A PS5 payload process on firmware 11.60 ran FT_Atan2, FT_Vector_Transform,
FT_Matrix_Multiply, FT_Matrix_Invert, FT_Outline_Check, FT_Outline_Get_CBox,
FT_Outline_Reverse and FT_Outline_Translate of libSceFreeTypeOt.sprx on its
own memory, twice (runs 2026-11-25T033607Z/040546Z and 033616Z/040555Z,
identical). The entries now name what was measured and what is not matched
in this change: FT_Outline_Check returns 6 on the console and 20 here,
FT_Outline_Reverse reverses the first point of each contour too, and inputs
outside signed 32 bits are computed in 64 bits.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
FT_Atan2 of libSceFreeTypeOt.sprx on a PS5 with firmware 11.60 returns
+180 degrees (0xb40000) for dx < 0 and dy = 0, where the bundled FreeType
returns -180 degrees. The adapter now returns +180 degrees in that case.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A PS5 payload process on firmware 11.60 returned +180 degrees (0xb40000)
from FT_Atan2 of libSceFreeTypeOt.sprx for dx < 0 and dy = 0 (dx = -0x10000
and dx = -0x80000000); the bundled FreeType returns -180 degrees for
-0x10000. The test now expects +180 degrees there and pins the eleven other
in-range results measured on the console.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The entry no longer says the console's choice is unknown: a PS5 payload process
(firmware 11.60) added POLICY_CHECK in two runs. It names what the probe did not
cover (a module-created object, X509_VERIFY_PARAM_get_flags, later calls, the
prototype and offset 24 as assumptions).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
On a PS5 payload process (firmware 11.60), setting EXPLICIT_POLICY, INHIBIT_ANY
or INHIBIT_MAP returned 1 and added POLICY_CHECK, in two runs. The function
threw NotImplemented in that case when POLICY_CHECK was neither set nor
requested. It now adds POLICY_CHECK, as LibreSSL 2.5.4 does, and returns 1.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
On a PS5 payload process (firmware 11.60), setting EXPLICIT_POLICY, INHIBIT_ANY or
INHIBIT_MAP with POLICY_CHECK neither set nor requested returned 1 and added
POLICY_CHECK (0x100 -> 0x180, 0x200 -> 0x280, 0x400 -> 0x480; a following 0x1 gave
0x181), in two runs. main throws NotImplemented there and leaves the parameter
unchanged. The test pins these measured cases and one unrelated flag.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* test(libwebrtc): zero the whole IPv6 address in the NetworkManager test
* test(libwebrtc): zero every address union in the NetworkManager test and check a middle byte
* feat(libwebrtc): implement VideoFrameBuffer::CropAndScale on libyuv
* fix(libwebrtc): measure a flipped crop by its magnitude in CropAndScale
* fix(libwebrtc): halve the scaled width without overflow in CropAndScale
* fix(libwebrtc): check every CropAndScale argument before allocating
On x86-64 Linux a PROT_WRITE-only page is still readable, so the default
guest copy succeeds and Initialize returns 0. The check only held with
APS5_GUEST_COPY_SYSCALL=1. The legacy write-only case stays.
No test read the type_info records of most standard exceptions, or
their vtables. Check that the std::exception and std::ios_base records
have no base, and that every derived exception record names its class
and points at the base the C++ standard gives it (logic_error,
runtime_error, bad_alloc or exception). Check also that the records of
each kind share one type_info vtable, and that each exception vtable
has a zero offset, its own type record and all three members.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No test called the Dinkumware entry points _Btowc, _Wctob,
_Getpmbstate or _Getpwcstate, or read the __mb_cur_max variable. Check
that _Btowc and _Wctob agree with btowc and wctob, including EOF, WEOF
and a character a byte cannot hold; that the two state pointers are
distinct, stable within a thread and different on another thread; and
that the C locale's maximum is 1 from both the variable and
___mb_cur_max.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
guest_dinkumware_atomics covered the _Atomic_* calls and some of the
sized __atomic_* calls, but no test called __atomic_store_1/4,
__atomic_load_2/4, __atomic_exchange_1/2, most __atomic_fetch_* sizes,
or the legacy _Fetch_*_seq_cst_1/2/4 and _Fetch_*_8 calls. Check each
one's returned old value and the stored result, including wrap-around.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sceHttp2SetRedirectCallback returns 0x817B1100 for a context or cookie
box id, and sceHttp2SetSslCallback for a cookie box id, as the other
option and callback setters do on the 13.42 module, instead of throwing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A sampled surface that crosses two guest allocations, each with its own host
import, was joined into one new import before its storage image could serve
it. The join pins and watches the whole run again: in Mafia: Definitive
Edition's city load, two cube arrays (233 and 467 MiB) joined 668 and 680 MiB
runs, ~150 ms each on the queue worker, the second one re-pinning the first.
Block-unit storage images already upload, refresh and store through import
segments, so a surface that the existing imports cover piece by piece now
counts as host-imported: HostImportSegmentsCover checks the cover without
making an import, SampledFromStorageEligible accepts such a block-unit
surface, and PresyncSurfaces treats it as GPU-direct like a single import.
APS5_NO_IMPORT_SEGMENT_VIEWS=1 joins as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GuestMemory::Read, ReadCommitted and the write path sampled their caller on
every 256th (16th for writes) call: a dladdr and a mutex on the calling
thread. The samples feed only the [guestmem] line, which is printed under
APS5_PROFILE_DRAW, so without the switch nothing read them.
#25319 rewrote the SSL and SSL_SESSION retains entry in its own fragment
while the older SSL_CTX_new fragment still carried the previous text, so
debt_fold --check failed on main. Keep the newer text only.
Latin1 and Utf16 take a const reference, so a StringImpl built from a
literal pointed into a temporary string that was gone before the regex
read it. The wide pattern case read freed stack and failed on Linux.
Name the backing strings so they outlive the StringImpl.
The admission filters were sized from the entry cap, so raising the
cap to 262144 also quadrupled them: far more draw keys counted as seen
before and were admitted. On Trails in the Sky the 2nd Chapter the
cache then filled to its byte limit and churned up to ~75% more
inserts per 10 s, costing ~5% of frames. Size both filters from
min(entries, 65536) instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 70000-draw case took about 60 s under the validation layer, over the
30 s limit for tests. The default cap is now public as DrawCacheEntries,
and the test requires it to be 262144 with APS5_DRAW_CACHE_ENTRIES unset.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The draw cache's default entry count goes from 65536 to 262144. The
byte budget (APS5_DRAW_CACHE_BYTES, 256 MiB) is unchanged and still
bounds what the cache holds; APS5_DRAW_CACHE_ENTRIES=65536 restores the
previous default.
agc_driver_draw_cache_capacity keeps its 4352-draw reuse case and adds
a case that sights and inserts 70000 more distinct draws: it requires no
eviction and more than 65536 entries held. With main's default it fails
with 6814 to 6974 evictions.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(libc): cover __atomic_compare_exchange_2 on a match
* test(libc): cover __atomic_compare_exchange_2 on a mismatch
* fix(libc): scope each atomic check in its own block so the test compiles
* test(libc): match guest_atomic_2 Windows test setup to its neighbours
Co-authored-by: pr-review4 <pr-review4@ps5team>
Co-authored-by: MarcZX100 <marczxrr@gmail.com>
std::_Getloctxt<wchar_t, istreambuf_iterator<wchar_t>> (i4J5FvRPG-w) and
std::_Getloctxt<char, istreambuf_iterator<wchar_t>> (FX+eS2YsEtY) were
inventory placeholders that threw. They now run the field walk of the
implemented char form, read from the firmware module in #22452, on
16-bit input: GetLocaleText takes separate table and input element
types, and a char table byte is compared with the input element by
integral value, sign-extended as Dinkumware's _Ptr[_Off] != *_First
promotes it. Null arguments return -2 as the char form does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(libkernel): pin fcntl F_GETOWN and F_SETOWN on a pipe
* fix(libkernel): keep the owner F_SETOWN sets on a pipe and return it from F_GETOWN
* docs(debt): state the F_GETOWN and F_SETOWN results of a PS5 payload process
* test(libkernel): pin that a pipe duplicated before the first F_SETOWN shares its owner
* fix(libkernel): create the owner of a pipe before a duplicate can share it
* docs(debt): state that dup, dup2 and F_DUPFD share the owner of a pipe
Same CMake cache-parsing failure as the other tests in this branch: the
compiler path from shutil.which reaches -DCMAKE_C_COMPILER with backslashes
on native Windows. Use forward slashes in the five fixtures.
shutil.which returns native Windows paths. Passed to cmake as -D values
they break CMake's cache parsing on Windows ("Invalid character escape
'\M'"). Normalize the paths with Path.as_posix() in the four tests that
pass them to cmake: test_configure_seed, test_package_release,
test_build_changed_guest_tests and test_check_compile.
* fix(libSceFreeTypeOt): refuse misaligned guest records in ft_module_get_service
* test(libSceFreeTypeOt): reject module records aligned to 4 but not to 8
* test(libSceFreeTypeOt): reject module classes and libraries aligned to 4 but not to 8
guest_icu_utf_conversions converted each of the 1,112,064 Unicode scalars
with three separate calls. Since the conversions copy their operands through
guest memory, that takes about 9 s on Windows and 9.5 s on a 4-core Linux
container against the test's 10 s timeout, and it times out under parallel
load. The sweep now converts the scalars in runs of about 8 KiB of UTF-8,
comparing every unit of each run in all three directions, and keeps the
single-scalar checks, with their canaries, at every UTF-8 and UTF-16 width
boundary.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
APS5_INDEX_IN_PLACE_BEHIND_WRITER refused every draw whose vertex shader
has fixed vertex attributes, because sizing the vertex buffer copies needs
the highest index, which the CPU cannot read while the GPU still writes the
indices. Those draws fell back to a CPU wait for the writer, taken under
the GPU mutex.
Take them behind the writer too and read each vertex attribute from its
whole buffer descriptor, as an indirect draw already does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test never passed a type name or message near the 65536-byte limit of
the checked copies, so counting a too-long type as copied, or printing
the what() prefix for a message that did not fit, still passed. Check
that a 65535-character type prints in full, that a 65536-character type
prints as (unknown) and that a 65536-character message is left out. From
Helldiverr's Windows mutation run on #25985.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ICU4C never opens uprops at runtime. Grapheme and InCB properties come
from the compiled in uchar_props_data.h and ExtPict from uemoji.icu,
which is already embedded. Also update the debt note, which still
described break iteration.
The official guest_bgft suite covered the Ex registration checks but not
the alias ordering (null params before the init gate), the parameter
fields the module never reads, or the task id staying unwritten. These
assertions pin the firmware 13.42 ladder recorded in
docs/dev/debt/libSceBgft.md so a later change cannot start rejecting
titles on unread strings.
AI-assisted: yes (FreeBuff). Adds coverage for the documented sceBgftServiceIntDownloadRegisterTaskByStorage ladder.
sceFontMemoryTerm, sceFontDestroyLibrary, sceFontDestroyRenderer, the
sceFontOpenFont* handle slot and sceFontDeleteGlyph checked their output
with GuestWritable_nid_no_patch alone. On Windows a guest page armed for
write tracking is read-only until a host write opens it, so a valid call
on such a page returned SCE_FONT_ERROR_INVALID_PARAMETER, and
sceFontDeleteGlyph kept the glyph. Use Font::OutputWritable, which opens
the same GuestArena::HostWrite first. guest_font_output_pointers_watched
runs each of these calls with its output on a write-watched page. The
Writing records debt line now describes the local record and the early
check.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A draw that stores through two overlapping buffer descriptors stages
one region and owes its pass shadow both written ranges. The new case
checks that both reach guest memory through the one copy-back at the
pass end, which fails if the owed ranges are not merged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Recorded draws that store to one staged buffer each ended the open
render pass twice, once for the copy-in and once for the copy-back.
With APS5_PASS_STAGING the builds of recorded draws bind one
device-local shadow per staged range, a draw whose shadow is still
current records no copy-in and keeps the pass open, and the changed
copy-back is recorded once when the pass ends.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ab_split.py reads arm names beyond A and B and gives each arm other than A
its own rows. With more than two arms or with APS5_AB_ROTATE, the noise column
compares each phase of an arm with the A phases of its own cycle, whose length
the [ab] header gives, so the drift cancels over the rotated orders. The two-arm
form without rotation keeps its neighbour pairing.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
With APS5_AB_ROTATE set, cycle k of the plan begins with arm k modulo the
number of arms, so no arm always comes first. The [ab] header says so, and the
phase lines still name the arm of each phase.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
APS5_AB takes <seconds>:<arm>|<arm>[|...] besides the two-arm list. An arm
is A (the environment's settings), a named group <name>=<switch>[+...] or
a name defined earlier, and phase k uses arm k modulo the arm count. The
[ab] lines carry the arm's name; the two-arm form still prints A and B.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
fix-rudp-unconnected-read-write.md and fix-rudp-net-received-checks.md
both changed the sceRudpProcessEvents, sceRudpNetFlush and
sceRudpNetReceived entry, so tools/debt_fold.py --check fails on main.
One fragment now keeps the change for sceRudpProcessEvents and
sceRudpNetFlush, the sceRudpWrite and sceRudpRead entry, and the
sceRudpNetReceived silent stub from 7fb2d48038.
scandir sorted with std::sort, which needs a strict weak ordering and passed the
comparison pointers to locals. A guest comparison that always returns -1 crashed
the host. Sort the returned array with qsort_r through a thunk, as FreeBSD 11.4
scandir.c does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cache the digest of each resolved path while its file identity and metadata stay the same. Compute a new digest when the signature changes and reject a target that changes during hashing. Each candidate still goes through the relinker independently.
* feat(libc): implement fmtmsg
* test(libc): capture fmtmsg output at the descriptor level
* test(libc): include sys/stat.h for the fmtmsg capture on Windows
* fix(libc): follow FreeBSD for fmtmsg output and return codes
Labels fill the label windows to 16 MiB. Before any build every window is
held, so the next label keeps its CPU path and the windows do not grow.
After a build the next label is recorded on the GPU: the least recently
used window (the first case's) is retired, the newer ones stay and every
label lands.
agc_driver_label_import_window lowers the import budget below a 1 MiB
allocation and stores a label in it. The label must be recorded on the
GPU (reason 0) through one 64 KiB label window, pin exactly that window,
count it as label bytes and land without touching its neighbours.
The budget refuses a label window exactly when the label's allocation was
refused, so the window rarely imported. Label windows now bypass the
budget, its eviction and the remembered refusals, and have a limit of
their own: at most 16 MiB of windows are live. A window past the limit
retires the least recently used label window that the import eviction
rule would let go (not held by a build, not used in the current or the
previous frame) and rewatches what it unwatched, as retireLeastRecent
does; when no window can go the label keeps the CPU path. Retiring and
clearing the imports keep the label bytes in step.
FTW_MOUNT reports a directory on another device than the starting path
once and does not enter it, as fts's FTS_XDEV does. FTW_CHDIR, which
fts honours only for a physical walk, runs each callback in the
directory holding its entry and restores the starting directory; a
directory that opens but cannot be entered reports its entries as
FTW_NS and ends the walk with -1, as FTS_ERR does in nftw.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A PS5 payload process on firmware 11.60 returned 16 from
sceAgcAcbJumpGetSize and 8 from sceAgcAcbRewindGetSize in three calls
each, also with the argument registers 0, 1, 2, 3, which equals the
values AnyPS5 returns (run 2026-11-24T153625Z). The two existing
entries now say that the return value is measured and that the size of
a written packet is not.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
FreeBSD's nftw opens its fts walk with FTS_COMFOLLOW, so the starting
path is stat'ed (falling back to lstat for FTS_SLNONE) even with
FTW_PHYS, and fts_open rejects a zero-length path with ENOENT. A
starting link to a directory was reported as FTW_SL and not walked, a
dangling one as FTW_SL, and an empty path called the callback with
FTW_NS.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Creating the --out directory or writing a report could raise an uncaught
OSError. Handle those filesystem errors in write_reports and exit with
the same pr_overlap diagnostic used by the CLI for other errors.
Cover the failure with a test that points --out at an existing file and
mocks the GitHub and Git operations.
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
main ran git rev-parse without catching its failure, so running the tool
outside a git checkout ended in a CalledProcessError traceback, although
debt_split.py reports the same situation as a usage error. A missing
CMakeLists.txt (a checkout without the AGC library, or the wrong
directory) also escaped the command handlers as a FileNotFoundError
traceback, because only SplitError was caught.
Reproduction: from a directory outside any repository,
agc_test_split.py refactor printed a Traceback ending in
"CalledProcessError: ... 'git', 'rev-parse', '--show-toplevel' ... 128".
In a git repository without the file, it printed a Traceback ending in
"FileNotFoundError ... CMakeLists.txt". Both now exit 1 with a one-line
message and no traceback.
Tests: CommandErrorTests in test_agc_test_split.py; both cases produced a
Traceback before the change.
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
FileTree.cpp called libc's opendir, readdir and closedir, so the module
imported three names it also exports and patched_self_imports failed on
main. Use the directory helpers the module's own exports use instead.
The test's texts were readable heap strings or a fully unmapped address,
so copying whole 4096-byte chunks without aligning them still passed.
Print the last bytes of a readable page that has an inaccessible page
after it, with an exact, a longer and a negative length. From Helldiverr's
Windows probe on #25986.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An unreadable name and an empty name both return null and set a dlerror
message, so the test could not tell them apart. Check that the message
for an unreadable name says so. From Helldiverr's Windows mutation run
on #20622.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every unwritable-buffer call in the test took the short-buffer or
end-of-file path, so ignoring a failed copy of a line that fits still
passed. Add a line that fits and read it into an unwritable buffer. From
Helldiverr's Windows mutation run on #20587.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test called sceNpMemoryHeapGetAllocator only with an unwritable output,
so skipping its write still passed. Call it with a writable output while
the memory heap is alive and check the allocator it writes. From
Helldiverr's Windows mutation run on #20441.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sceFontWritingInit builds its record locally and copies it out at the end,
so an unwritable record was only found after PopulateWritingStep had looked
up the first glyph. Check the record first, under the same GuestArena host
write the final copy opens, so an unwritable record fails before any font
access again. The final checked copy stays for a page that changes later.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A queue-0 label whose memory no import covers synced the recorder and was
stored on the CPU (#7464). That is cheap for the small blocks it was made
for, which the title maps every frame, but a label in a large allocation
that the import budget refuses waits for every batch in flight each time.
In Cult of the Lamb (PPSA06465) on a Renoir APU, whose import budget is
586 MiB, the labels land in 16 MiB allocations and the sync costs about
60 ms per frame in gameplay.
Such a label now requests a 64 KiB window of its allocation (Label
requester) and is recorded on the GPU when the window imports. An
allocation no larger than the window keeps the CPU path, so the small
blocks of #7464 are still not imported.
ImportRequester gains Label, named "label" in the host import report,
for imports a label store makes so it can be recorded on the GPU. No
import is requested with it yet; the report test now lists it.
importWindowBounds and windowRun read rangeImportWindow themselves. They
now take the window as a parameter that defaults to it, so a caller can
import a narrower window of a large registered range. No caller changes.
A host lookup that took longer than the request's resolve timeout threw
"request timed out; console error mapping is unknown". On a PS5 the
resolve timeout does not end a lookup: with a 1 s timeout an unanswered
lookup kept resending queries and failed with 0x804101E2 only after
30 s (measurement in docs/dev/debt/libSceHttp2.md). A lookup now waits
for the host resolver until the request's overall deadline, and a lookup
the host resolver reports as unanswered (EAI_AGAIN) returns 0x804101E2
instead of the NXDOMAIN code 0x804101E6.
LEGO Batman: Legacy of the Dark Knight (PPSA16833) sets a short resolve
timeout for its telemetry requests and aborted when one host lookup was
slow.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(libSceMove): validate type against SDK version in sceMoveOpen
* fix(libSceMove): call ApplicationCompiledSdkVersion after the main rename
Co-authored-by: oneandonlydean <158058829+oneandonlydean@users.noreply.github.com>
DepthSurfaceStorage scanned every depth surface under the registry mutex
on each call. RepeatStorageSurface calls it for each resident color
target of each draw, and the answer is almost always that no depth
surface holds the address.
Each thread now remembers the device and address pairs the scan found
unclaimed, together with the registry serial it read under the mutex. The
serial moves whenever a surface is created or a retired one is bound
again; a surface never changes address or device and only loses its
active flag, so an unclaimed answer holds until the serial moves.
DepthSurfaceStorageScans counts the calls that reached the scan, for the
test.
The debt file is edited through a fragment in docs/dev/debt/changes/, not
directly, so the entry moves there and the Focus pause for rumble bullet
keeps its place in the file.
Drop the keep-awake holder, its SDL backend and its tests. SDL already
disables the screen saver when its video subsystem starts, and main sets
no hint that lets it run. ANYPS5_KEEP_AWAKE=0 now sets
SDL_VIDEO_ALLOW_SCREENSAVER=1 before SDL's video subsystem starts, so the
host screen saver can run; any other value keeps SDL's default.
The Windows pull-request lane builds `libs`, links the selected test
targets and runs CTest inside one step, so the log cannot say which
phase spent the minutes. `build_changed_guest_tests.py` now prints a
`[ci-timing]` line with the elapsed seconds and the target or test
count after each phase: the libs build, the selected and additional
test links, the CTest discovery and the CTest run, plus a total. The
lines print from `finally`, so a failed build or test still leaves them,
and the compiler-cache counters are printed before CTest so they survive
a test failure or timeout. The Windows job also reports ccache
statistics at the end, as the Linux job already does.
The Color constructors, assignments and the colorWithAlpha, darkened,
lightened, lightness and luminance accessors read and wrote the guest
Color objects directly. They now copy the object in with
GuestCopyIn_nid_no_patch, compute on the host copy and copy the result
out with GuestCopyOut_nid_no_patch; an unreadable or unwritable object
fails through NotImplementedAt_nid_no_patch instead of faulting. The
assignment exports return the object pointer, which is the same value
the reference return passed back.
test_assembles_both_wave_sizes_with_the_driver_comgr assembles for
gfx1201 since 2640fbc65a. AMD's Windows driver 23.19 lists targets up to
gfx1103, so amd_comgr_action_info_set_isa_name returns status 2 and
hardware_oracle fails there. The test now reads the targets comgr lists
and skips one it does not list. It requires gfx1010, so an empty list
fails instead of skipping every target.
AI-assisted: yes
A comparison gather (image_gather4_c and its _lz/_o forms) of a texture
the device cannot compare natively was marked unsupported, so no
emulated comparison mode was prepared and the draw was refused at
descriptor time.
The emulated color comparison now has a gather form: it reads the
bilinear footprint and returns the four per-texel comparison results in
gather order, through the same per-texel comparison as the emulated
sample. Horizontal gathers stay refused.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sceRegMgrGetVersion threw NotImplemented_nid_no_patch. A PS5 payload
process on firmware 11.60 returned 0x01140001 in five calls in each of
two character-identical runs, with the argument registers 0, with 1 as
the first and with 0, 1, 2, 3. The export now returns that value; the
int (void) prototype is an assumption of the probe and a title process
or other firmware may differ. The debt fragment of the existing entry
is changed in place.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
sceRegMgrGetVersion returned 0 through NotImplemented_nid_no_patch. A PS5
payload process on firmware 11.60 returned 0x01140001 in two runs
(2026-11-20T120411Z and 2026-11-20T130342Z, character-identical) for the
argument sets 0, 0, 0, 0; 1, 0, 0, 0; and 0, 1, 2, 3.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
refreshedFromLoggedChanges leased the imports of the changed windows and
compared them before it looked for a failed, refused, growth or sparse-run
entry in those windows, which makes it give up. Those checks need only the
merged spans, so they now come first, and a failed attempt costs a span
lookup instead of a lease. A pending import that the window walk already
checked is no longer checked a second time.
A DPP quad_perm read in a pixel shader broadcast all four lanes of the
quad and selected the source lane with a chain of OpSelect, even when
the control names the same lane for all four (0x00, 0x55, 0xaa, 0xff),
as the neighbour reads of an emulated derivative do. Such a read is now
one OpGroupNonUniformQuadBroadcast of that lane; the result is the same.
NVIDIA's compiler (driver 580.178.04, RTX 3080) segfaults building the
pipeline of a LEGO Batman: Legacy of the Dark Knight (PPSA16833) pixel
shader that holds 114 of these four-broadcast reads, so the title
crashed when it left the title screen. With one broadcast per read the
pipeline builds and the title reaches its main menu and a new game.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A cache hit whose read-only dispatch buffers moved bound each moved buffer straight from HostImportView. That view skips what every other host import lookup does: it does not reconcile a guest allocation registry that changed since the imports were made, and nothing refused the in-place read when a label the queue has not recorded yet, a queued store or a copied writer still targets the range. The dispatch now asks movedInPlace, the check a moved draw element read in place already passes, and binds the element through the draw path's in-place snapshot, which notes the read on the recorder at once. The prefilter without a recorder only asks whether an import exists. The draw path's moved-in-place counters stay the draw path's own.
DrawBindings no longer carries its own in-place list and read ranges, and MarkGpuWrites and the barrier validation no longer take them; the dispatch record keeps snapshot bytes only for snapshots with their own buffer.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Date.parse and new Date(string) built a local time with the Date
constructor and then always called setFullYear(year), which reads the
date's local time back and converts it again. In a daylight saving gap
that local time is not the parsed one, so a string such as
"Mar 14 2021 02:30" in America/New_York or "Mar 28 2021 02:30" in
Europe/Berlin parsed one hour away from new Date(2021, 2, 14, 2, 30).
Years 0 to 99 went through a 1900 to 1999 date, so 0000-02-29 became
1 March.
A year outside 0 to 99 now takes the constructor's value. A year in 0 to
99 starts from noon on a fixed day, sets the date with setFullYear and
the time with setHours, so the requested fields are converted once.
nkwebkit_jscdateparsing passed only where the host zone has no daylight
saving time. It now also runs under TZ=EST5EDT and
TZ=CET-1CEST,M3.5.0,M10.5.0/3.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
connect marked a stream socket pending before the host connect, but a
send in between polled the still unconnected descriptor, which Linux
reports writable with POLLHUP, and cleared the mark; the connect then
went into SYN_SENT and later sends reached the host. A second connect
that failed at once while the first was entering the host cleared it
too. Count the connects inside the host call: send answers ENOTCONN
while any is there, a host connect that returns in progress sets the
mark, and one that fails clears it only when no other connect is in the
host and the socket is not in SYN_SENT. A test-only hook runs inside
connect before the host call so the test can send and connect there.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When a device allocation does not fit, ReleaseTextureCaches evicts cached
storage images. An image used since the last scan was spared once and then
evicted on the rescan, so a large request freed images the title uses every
frame, which were made and uploaded again on the next frame. Record the
present of each cached storage image's last lookup, and leave images used in
the current or previous present to host placement instead. Before the first
present the release behaves as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Scan libraries for tools/progress.py in a process pool, and let
tools/pr_overlap.py --names skip fetching pull request heads that the
local repository already has. Rebuilt as one commit on current main,
keeping the per-commit fetch fallback for heads that move during a run.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When the game's DCC key fill is still a recorded GPU write at bind, the
old path synced it (CurrentDccKeys) and ClearMip's pending-write refusal
still fired over the surface's key extent, so the bind fell back to the
CPU store (a full memset of the viewed mip plus a re-upload, every frame
the game re-clears the target). Answer the keys from the recorded writes
instead (LandedDccKeys, no sync): every pending writer a fill leaving one
fillable clear code takes the GPU clear with the clear recorded after the
fill in the same queue; a fill of 0xff clears nothing; mixed, partial or
an unknown writer falls back to the current keys, as before. ClearMip now
skips its pending-write checks when the caller passed a verified code
clear. Remove the temporary MIPCLEAR-PROF profiling counter.
Tests: three pending-fill scenarios next to the existing mipmapped clear
test -- a pending clear-code fill must take the GPU clear with no sync and
no guest write at bind (it fails without the change: ClearMip refuses, the
CPU fallback writes the guest at bind), a pending 0xff fill must not
materialize a clear, and a pending partial fill takes the fallback path
and stays correct.
Replace the per-draw CPU settle (store the clear over the whole mip and
re-upload it) with a GPU clear of the viewed mip's subresource: the image
holds the clear, the guest bytes follow through the write-back, which now
stores the filled mip whole (holdsClearFill). The single-level DCC path
already serves a uniform clear from the image; this extends it to the
mipmapped target whose chain image otherwise starts from the stored texels.
The test for the draw reads the guest buffer directly: the GuestMemory
access hook would store the pending clear (the very write-back under test)
before a hooked read could observe the pre-write-back state.
A 2D mipmapped pipe-aligned DCC color target carries the whole chain's
metadata, but only the viewed mip is written; the driver parked the key
address in chainDccAddress and ignored the keys, so the target uploaded
the stored texels (an alias's bytes) instead of starting from the fast
clear. Give the viewed mip its own key range -- the AMD addrlib
HwlComputeDccInfo layout, small mips first, each a whole number of
4096-key blocks, the viewed mip's slice last -- and settle its range to
the clear colour before the resident lookup when that slice is one clear
code, so the draw starts from the clear like a single-level target.
Arrays and 3D keep the chain address and the existing log line.
The key reads keep the historical per-256-bytes count; the viewed mip's
padded extent sizes the marks and overlap checks, as the padded console
extent already did for single-level targets. APS5_NO_DCC_MIP_FAST_CLEAR
turns the fix off.
Adds RunMipmappedClearDraw: a 128x128 8-mip R64KBX chain with a 0000
clear over stale texels in the viewed mip's slice; a 0.5 premultiplied
draw must see 128 inside the scissor and the clear outside, and the
viewed mip's keys must end uncompressed. It fails with
APS5_NO_DCC_MIP_FAST_CLEAR=1.
When an invalid UTF-8 sequence is split over more than two calls, the JSON
reader marked the buffered bytes as consumed and then discarded them. The
bytes after the lead were lost, and in some splits bytes were emitted twice.
Buffer only UTF-8 continuation bytes, emit an invalid lead alone, and replay
the buffered bytes that follow it on the next reads. Add three-chunk split
regressions for a lead followed by an ASCII byte and for a valid partial
prefix followed by an ASCII byte.
The mapper lacked the ToggleBorderless action that the native parser
accepts, so the action-name and conflict-catalogue tests failed.
The action is keyboard-only, as in the native parser.
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
The multiple-subobject ambiguity check ran before the downcast branch, so a
downcast whose destination appears in several subobjects (one per base of a
derived class) returned null even when only one of them contains the source.
Apply the check after the downcast branch so it only governs the cross-cast
path, and cover the shared-Mid shape in both base orders.
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
uprv_deleteUObject forwarded the guest pointer to the bundled ICU's
uprv_deleteUObject, whose delete calls the guest's deleting destructor
with the host C++ calling convention. A guest vtable holds System V
functions, so on Windows that call breaks the System V contract; it
only worked because the export left the object in rdi.
Read the vtable through checked guest copies and call slot 1, the
deleting destructor that ICU 68.2's delete uses, as an APS5_VABI
function. An unreadable object or vtable and a null slot throw.
DepthRenderControlDrains drained the draw pipeline for every multisampled
DB_RENDER_CONTROL with STENCIL_COMPRESS_DISABLE or DEPTH_COMPRESS_DISABLE,
so that NoteDepthRenderControl finds a surface a queued draw registers.
NoteDepthRenderControl changes a surface's expanded state only for a depth
expand (with a stencil expand or no stencil plane) or a clear. A control
with only the stencil expand bit and no clear bit changes nothing but the
renderControl value that one diagnostic prints, so it no longer drains.
Depth expands and clears drain as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After the exact-equality check, Agrees only rejected a pair of opposite
zeros, so a measured zero accepted a minimum subnormal of either sign once
the scale divide rounded it to zero. Reject when either value has zero
magnitude, and check on the host that zero against the signed minimum
subnormal is rejected while a 1 ulp drift on a normal result still passes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
macOS reserves the console's 0xfe0000000, so the AGC driver block and the
FS table inside it move to 0xee0000000 there. A shader that builds the table
address from two s_mov_b32 literals still loaded it from 0xfe0040000, which
macOS cannot map, so those dispatches could not link: the callee lookup read
the descriptor from the console address and the shader loaded from it too.
The driver now rewrites those two literals to the moved address, for the
callee lookup and for the code the GPU runs, and ComputeFsTableCalls runs on
macOS.
The pull request edited docs/dev/debt/shader.md directly. Debt entries are
changed through a fragment in docs/dev/debt/changes/, so the edit to the
output modifier entry moves there unchanged and shader.md is left as on
main.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pull request edited docs/dev/debt/shader.md directly. Debt entries are
added through a fragment in docs/dev/debt/changes/, so the entry moves
there unchanged and shader.md is left as on main.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CONTRIBUTING.md requires new libkernel test executables to be registered in tests/cmake/<executable>.cmake. The test moves there unchanged.
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
test_registration ran all six classes of test_test_registration.py in
one CTest test. It took 29.0 s on the Windows CI runner (run
45139610913) and 83 to 100 s on an i7-8750H laptop, where it timed out
at 120 s when it shared the CPU with other tests.
test_registration now runs RegistrationTests, and every other class is
its own test_registration_<class> test, as conventions_wrapped_declarations
does. The longest class, DisabledScriptRegistrationTests, takes 25 s on
the same laptop.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A console returned 0x8A700002 for the path handles 0 and -1 with a valid
count variable, and for the handle 0 with a null and an unmapped count
pointer, leaving the count unchanged. An unknown path handle now returns
ErrorInvalidHandle before the count pointer is read, as
sceAudioPropagationSourceGetAudioPath already does for the same handles,
instead of throwing.
Two existing test lines changed: the paths of a destroyed source and of a
destroyed system (GuestAudioPropagation.cpp, "path survived source
destruction" and "path survived system destruction") expected a thrown
invalid_argument and now expect ErrorInvalidHandle, because a destroyed
path leaves the registry like an unknown handle. Only the handles 0 and -1
were measured; the answer for a destroyed handle is assumed from the same
lookup.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
StoreDrawnLinear asked HostImportCovers, which takes the host imports
mutex, while it held the pending storage image mutex. ImportMappedRanges
holds the imports mutex and then takes the pending mutex through
AnyPendingOverlaps, so the two threads could each wait for the other.
The pending mutex is a leaf lock.
StoreDrawnLinear now keeps the trap candidates alive, releases the
pending mutex, asks HostImportCovers, and takes the pending mutex again
to set the traps on the candidates still drawn and dirty, as
StoreSmallPending already does. Taking the imports mutex under a leaf
lock now aborts when lock order is checked, and APS5_ASSERT_LOCK_ORDER
checks it without the GpuMutex assertions of APS5_ASSERT_GPU_LOCK.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The three exports print a fixed notice before returning 0x818D0001, and the
test only checked the return values. Each notice is now its own ctest entry
that runs the binary for that export and matches the string as regular
expression, so a missing or reworded notice fails the test.
main's guest_hub_app_util test, which expects the old returns, is folded
into this one instead of staying beside it.
Eleven mangled exports over Leaderboards::V1 were still missing from the
library, so the relinker could not resolve them: Entry's IntrusivePtr copy
constructor and destructor, Vector<IntrusivePtr<Entry>>::operator[] and the
IntrusivePtr<Vector<Entry>>::get accessor, TransactionBase::abort and
Transaction::hasResponse over the GetRanking, RecordScore and
GetBoardDefinition response bodies, and hasResponse over the Activities
GetUsersActivities response body.
They answer like the instantiations already present: hasResponse returns 0,
abort returns TransactionNotStarted, Entry's copy constructor and destructor
count references, get answers nullptr over an empty handle, and
Vector<IntrusivePtr<Entry>>::operator[] still throws when it cannot read the
title-provided vector, as its siblings do.
The other twenty-five exports this branch used to add are now in main.
The Windows CI check requires every test executable to run under ctest, and a disabled test does not. On Windows the test now checks that mkfifo throws NotImplemented, and the POSIX checks are compiled out there.
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
All three exports print the firmware's own notice and return 0x818D0001.
In the 13.40 module each body is 23 bytes: one constant string passed to the
libc puts import, then the error code, without reading an argument, so the
behaviour is the same for every input and the parameterless declarations stay
valid as import-resolution placeholders. Read from disassembly, not measured on
a console.
The test calls the three exports and checks the return value. The notice was
compared against the strings in the module.
Creates a FIFO at the path that mkdir resolves, through the host mkfifo with the same mode handling as mkdir, and reports host errors as the guest's errno values. Windows has no FIFOs, so it throws NotImplemented. The test checks that the new entry is a FIFO, that a second call reports EEXIST, and that a missing parent reports ENOENT.
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
CallbackExoticSetProperty walks the prototype chain of a callback object.
When a prototype has the property as a data property, it freed curProto
and broke out of the loop, and the loop's exit freed curProto again. Each
such assignment dropped one reference of the prototype, which QuickJS
then freed while objects still used it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014W1f1RvDMX4BmYudy9J2Vj
Under ASan with detect_stack_use_after_return, a local's address lies on
the heap-allocated fake stack, so the QuickJS stack limit set at VM entry
and the libregexp stack budget were computed from the wrong stack and
every script or regular expression reported a stack overflow.
__builtin_frame_address(0) always points at the real stack, as QuickJS's
own js_get_stack_pointer does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014W1f1RvDMX4BmYudy9J2Vj
Implement the 3.20 WebCore::WebSocketFrame constructor (C1 and C2) from
the 2020 WebSocketFrame.cpp, with the frame laid out as in the header.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
sendmsg with SCM_RIGHTS threw on Windows, where socket pairs are loopback
TCP and UDP sockets. A SOCK_STREAM or SOCK_SEQPACKET pair end now queues
guest duplicates of the passed descriptors on its peer, keyed to the
stream byte or record their data starts at, and recv, recvfrom, recvmsg,
read and readv keep that queue in step with the data under one lock.
Delivery follows FreeBSD 11.4: a stream read and MSG_WAITALL stop where a
message with descriptors starts, each SCM_RIGHTS message stays separate,
messages that do not fit are closed with MSG_CTRUNC, and a receive
without a control buffer, SHUT_RD or closing the receiving end closes
them. SOCK_DGRAM pairs still throw, as Windows drops datagrams sent to a
full receiver.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The recording writer was a separate function-local static whose
initializer could run on a call where the replay static had already
been constructed, so the guarantee that the APS5_PAD_RECORD output was
opened with trunc only once the replay had loaded rested on the two
declarations staying in order and on the exception from the failed
player initializer skipping the writer declaration. Make the
dependency explicit control flow: the replay pair is built on first
success and the writer, including its same-file guard, is only
constructed once the replay has been built. Retry semantics are
unchanged: a failed replay or writer construction is retried on the
next call from the current environment, a completed one never re-runs,
and the equivalent/exists guard keeps failing closed on opaque
comparison errors while recording to an existing file stays allowed
when the replay path is absent.
Extend the recording harness to hold APS5_PAD_REPLAY and
APS5_PAD_RECORD set across repeated refused reads, for both a missing
and an invalid replay file, and require the preexisting record file to
stay byte-for-byte unchanged after every refused read; a writer that
opens ahead of a successful replay build fails this assertion.
A whole HTILE fill over a native multisampled depth target refused with
"metadata fill over unwatched memory" while a host import of the HTILE
was still waiting for its deferred settle, although the memory is
watched again once that import settles. Settle the imports under the
fill for each device with a sampled native depth target there, after
taking the GPU mutex and before the depth surface lock, so the import
lock is never taken under the surface lock.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The standalone [sinhl] fragment matched no libc entry, and the shared
[expl, sinhl, coshl and tanhl] entry is already changed by
fix-expl-ld-exp.md, so add the sinhl sentence there instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
std::filesystem::equivalent sets an error when either path is missing, so the writer guard threw cannot-compare and blocked recording to an existing APS5_PAD_RECORD whenever APS5_PAD_REPLAY pointed at a path absent from disk. Check that the replay path exists before comparing; keep failing closed on opaque comparison errors and on same-file aliases via equivalent.
The tool-memory fragment on main already changes the six-name throwing
entry and removes the libkernel_sys tool-memory row; a second fragment
targeting the same base entries cannot fold. Update its change op to
produce the implemented sceKernelSetProcessProperty entry directly.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
num_put<wchar_t>::num_put(const _Locinfo&, size_t) had its base-object
constructor (C2) implemented but its complete-object constructor (C1)
was still the inventory stub libSceLibcInternalInventory_133, which threw.
num_put has no virtual bases, so under the Itanium ABI C1 does the same
work as C2; it now runs the C2 export with the same arguments.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The stencil plane of a native multisampled D32S8 target was sampled
through a descriptor without metadata only when the HTILE held depth
alone; with the stencil in HTILE every such read threw "native
multisample depth sampled metadata or XOR mismatch". With the stencil
in HTILE the plane in memory is compressed until an in-place expand,
which is why the read was refused. Depth reads without metadata are
already accepted after an observed in-place expand of depth and, with a
stencil plane, stencil (DEPTH_COMPRESS_DISABLE and
STENCIL_COMPRESS_DISABLE). The stencil read now follows the same rule,
until the same HTILE clears, fills and clear draws that end it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A native multisampled depth target with HTILE accepted a descriptor
without metadata only after an observed in-place expand draw; any other
such read threw "native multisample depth sampled metadata or XOR
mismatch". Publishing the target to guest memory writes every HTILE
word expanded and the planes from the host samples, which is the state
an in-place expand leaves. When every plane was committed whole and
unchanged by the guest, the target is now taken as expanded, until the
same clears and fills that end an expand.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The event loop now owns the SDL_TEXTEDITING_EXT allocation and releases it after all handlers ran, so later handlers never see freed text and a throwing handler does not leak it. ImeTextInput only reads the text.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016k2buKhRwzEctC4cJhXum3
ICU's ures_getStringByIndex hands a table or array item to res_getString,
which returns no string and leaves the status for an item that is not a
string, so ures_toUTF8String returns the empty string. The accessor
reported U_RESOURCE_TYPE_MISMATCH instead.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
XashPS5 stops at three raw shader tails: a vertex prolog run as the front of a geometry draw (mesh stage), fragment tails that jump through an s_mov_b32 copy of the user-data low half, and fragment tails whose body branches with s_cbranch_execz to an exp/s_endpgm exit placed after the s_setpc_b64. Accept the mesh stage in both tail gates, accept one copy of unchanged user data when the high half is an immediate, and accept forward branches into a branch-free trailing exit ending in s_endpgm, which the linker keeps by jumping over it to the continuation.
Iterator increment and advance already fail through StoreGuest when the state is not writable, so the extra GuestWritable probe only added a syscall per step. The new overlap and aliasing rejects now use NotImplementedAt like the other guest-access failures in this file.
ungetc and ungetwc switch a read/write stream to reading before they
push the character back. When that switch cannot flush pending output
(a full non-blocking socket, for example) they returned EOF or WEOF
with the host's errno still in place, so on Linux a guest read 11
where its own EAGAIN is 35.
Both now use the pattern #14560 gave fgetc, getc_unlocked, fgets and
fread: save the caller's errno, clear it, switch, translate the host
value on failure and restore the caller's errno on success.
The socketpair loop in file_streams gains a row for each function.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The component loop of genericFormattedLoad converted each component once per (type, bit width) pair found in the format table. Unorm, snorm, scaled and integer components now take the component width at run time, so one conversion per type remains; float and d16 conversions keep one per width.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A NUL scan resumed at the chunk start, so an operand at an odd address that crossed a page boundary was scanned at the wrong byte parity. Resume at the last even offset so the scan always steps whole code units from the start of the operand.
u_strFindFirst and u_strFindLast passed guest addresses to the linked
ICU routines and pre-measured a NUL-terminated operand with a local loop
that threw NotImplemented_nid_no_patch once the length no longer fit
INT32_MAX. Both operands are now copied in through GuestCopyIn in
page-sized chunks, the search runs on the copies, and the result is
translated back to the guest string, so an unreadable operand raises
std::invalid_argument and neither export reaches
NotImplemented_nid_no_patch; tools/progress.py counts both.
The null, negative-count and empty-needle shortcuts keep ICU's order and
results, and a -1 length keeps the terminator in the copy so ICU takes
the same NUL-terminated paths as before.
Tested: contract, long-operand and page-crossing cases over mmap pages
pass, the pre-change body faults on an unreadable operand where the new
one throws, and 60,000 randomized cases return the same offset as host
ICU 74.
u_strFromUTF8, u_strFromUTF8WithSub, u_strToUTF8 and u_strToUTF8WithSub
dereferenced the guest source directly and wrote the destination unit by
unit behind a GuestArena::HostWrite guard that threw
NotImplemented_nid_no_patch when it could not open. They now read the
source through GuestCopyIn in page-sized chunks, build the result in a
host vector and write it once through GuestCopyOut, so an unreadable
guest buffer raises std::invalid_argument and no conversion path reaches
NotImplemented_nid_no_patch; tools/progress.py counts the four as
implemented.
The substitution count and the destination length are stored before
termination, and the status word is re-read the way ICU's aliased
pointers see it. Error codes, termination and the truncated-substitution
geometry follow ICU 68.2 ustrtrns.cpp, with malformed sequences decoded
by the in-tree utf8_nextCharSafeBody that Utf8.cpp implements from
utf_impl.cpp. u_strFromUTF8Lenient keeps its body because #22460
rewrites that function.
Tested: a host runner over UtfConversions.cpp and Utf8.cpp with the guest
copy seams shimmed; the guest test file passes against the new and the
pre-change object; 20,000 randomized cases and 200 aliased-scalar layouts
match host ICU 74; the pre-change body faults on an unmapped source page
where the new one throws.
fclose returned the host fclose result and left the host errno in
place. When the final flush failed, the guest saw the host's number:
on a full non-blocking pipe glibc reports EAGAIN 11, which is EDEADLK
for the guest, whose EAGAIN is 35. fflush, fwrite, fputs and fputc
already translate it.
fclose now saves the caller's errno, clears it before the close and
translates the host value only when the close fails and the host set
one, in the shape of fflush. In every other case the caller's errno is
kept, so a successful close does not change errno, as on FreeBSD.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
stat, lstat and fstatat with AT_SYMLINK_NOFOLLOW rejected a null buffer
before looking the path up, so stat("missing", NULL) failed with EFAULT
where FreeBSD 11.4 reports ENOENT: sys_stat, sys_lstat and sys_fstatat
call kern_statat first and copy the result out only when the lookup
succeeded. sceKernelStat already looks the path up first.
The three early checks are removed. An existing path with a null
buffer still fails with EFAULT, from the copy to the guest buffer, and
nothing is written through the null pointer.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Hexadecimal strtod and wcstod results of at least 2^-1074 in the
subnormal range came from the host strtod, and glibc rounds some of
them a unit low: 0x3ffffffffffff5p-1077 gave 0x0007fffffffffffe where
the measured libc.prx (PPSA08329) and correct rounding give
0x0007ffffffffffff.
These results are now rounded from the parsed significand and exponent
with integer rounding at 2^-1074 in the current rounding mode. errno,
the end pointer, normal results and results below 2^-1074 are
unchanged, and strtof and strtold are not touched.
The debt entry loses the sentence about the host rounding a unit low
and records that results below 2^-1074 still ignore the rounding mode.
The unscaled hexadecimal conversion entry records that _Stodx can end
one unit from strtod.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Driver.FinisherDrain was listed with the phases, but worker_busy_pct and the
frame timing's worker_accounted_ms left it out, so a worker blocked on the
draw finisher still looked idle. It now counts with the other worker scopes,
and BUILD.md and USAGE.md list it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GtFtGr39oKL1zCtAwH7vGx
The queue worker drains the draw finisher at the packet gate, before a packet that cannot run
beside it, and at the end of every queue-0 submission. Both waits sit outside Driver.Packet and
Driver.EndSubmission, so worker_busy_pct and the phase totals did not show them. They are now timed
as Driver.FinisherDrain, which the trace summary lists with the other phases.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GtFtGr39oKL1zCtAwH7vGx
open with O_CREAT and O_DIRECTORY (without O_EXCL) handed both flags to
the host. Linux 6.4 and later reject the pair with EINVAL for a missing
name, a file and a directory alike, and on Windows OPEN_ALWAYS created
a regular file for a missing name.
FreeBSD 11.4's vn_open_cred creates only when O_CREAT is set without
O_DIRECTORY; otherwise it looks the path up. OpenNative now treats
O_CREAT as absent when O_DIRECTORY is set: a missing name fails with
ENOENT and nothing is created, a file fails with ENOTDIR, a directory
opens, and a write mode on a directory still fails with EISDIR. The
EINVAL result for O_CREAT|O_EXCL|O_DIRECTORY is unchanged.
FreeBSD also skips the access check on this lookup; the host does not.
That gap is recorded in the libkernel debt.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The edge cases of attachISWrite, putBit16z and fillToByte used the fixed
addresses 0x10000 and 0x10 as unreadable guest state. On Windows the guest
arena starts at 0x10000 and the host can already have memory there, so the
copy succeeded in some runs, the position callback ran and the test aborted
with "attachment forwards original stream" (exit code 0xc0000409). The test
now reserves its own no-access page and checks that it is unreadable first.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A CB fast-clear eliminate or DCC decompress over a single-sample color
target whose memory a host-only multisampled color target still guards
looked up the target's resident image through CachedStorageSurface, and
the guard refused it ("a storage image access ... overlaps multisampled
color target"). Binding such a target as a color attachment already
claims the multisampled memory as reused (ClaimMultisampleTargetMemory
in the draw path); the metadata pass writes the same bytes, so it now
claims them the same way before it touches them, and the guard retires
the multisampled target instead of refusing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pasteboard helpers allocate through the guest application heap, so the fixture aborted with an unregistered heap on Linux and with "application heap: process metadata is missing" on Windows. Register host-backed allocate, free, calloc and reallocate through ApplicationHeapRegister, as the other fixtures in this tree do.
ObjectFromText allocates the encoded identifier through the guest application heap, so the fixture aborted with "application heap: invalid or missing process parameters". Register host-backed allocate, free, calloc and reallocate through ApplicationHeapRegister, as the other fixtures in this library do.
BIO_new_mem_buf allocates through the guest application heap, so the fixture aborted with "application heap: invalid or missing process parameters". Register host-backed allocate, free, calloc and reallocate through ApplicationHeapRegister, as the other fixtures in this library do.
- LayoutRect::unite, LayoutRect::contains and RoundedRect::contains
added raw LayoutUnit values as int. WebKit's LayoutUnit operators
saturate, so a rectangle whose right edge passes the maximum wrapped
to a negative edge here.
- LayoutRect::scale skipped the "infinite" rectangle by comparing its
origin with INT_MIN / 2; infiniteRect() starts at nearlyMin() / 2,
another value, so the real infinite rectangle was scaled.
- FloatSize::isZero compared with 0; WebKit compares the absolute
values with the float epsilon.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The pending debt entry said only that types 811, 815 and 1055 may differ
on LibreSSL 3.7.3. It now gives, from the 3.7.3 pmeth_lib.c method table
and gost89imit_pmeth.c, the reason each one queues there, and that 815
returns a key for a 32-byte key. A second entry records that
MacKeyRejection repeats the method types IsLibreSslOnlyPkeyMethod lists.
The Closes when line of the existing entry now reads as one condition.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
d2i_PUBKEY, d2i_RSA_PUBKEY, d2i_PKCS8_PRIV_KEY_INFO, EVP_PKCS82PKEY and
the BIO readers d2i_PKCS8_PRIV_KEY_INFO_bio, d2i_PrivateKey_bio and
d2i_RSAPublicKey_bio refused a long-form length below 128 or with a
leading zero octet with reason 102, so a key that the pinned 078b3d1d
LibreSSL decodes, such as a PKCS#8 whose outer SEQUENCE is written
30 82 00 xx, was not decoded. The in-memory reader now reads lengths as
asn1_get_length of that version does: leading zeros are skipped before
the eight-octet limit and any long form is accepted. The BIO reader
accepts up to six length octets and fails with ASN1_R_HEADER_TOO_LONG
beyond, as asn1_d2i_read_bio does with its eight-octet header read.
Indefinite lengths are still refused; the new debt entry says so.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
ucol_swap, ucol_swapInverseUCA, ucol_looksLikeCollationBinary,
unorm2_swap, ucnv_swapAliases, uchar_swapNames, ubrk_swap and
udict_swap call ICU 78.1, whose swap code matches ICU 68.2 except that
unorm2_swap accepts format version 5. That version is refused here
with ICU 68.2's message and U_UNSUPPORTED_ERROR, after the data header
is swapped as 68.2 does.
The guest's UDataSwapper, laid out as in ICU 68.2, is copied into a
host swapper whose functions call the guest's through APS5_VABI
pointers and hand them the guest's swapper. printError receives the
arguments as a System V va_list. cmake/Icu.cmake gains rbbidata.cpp,
dictionarydata.cpp and utext.cpp for ubrk_swap and udict_swap.
The test swaps the in-tree ICU data (ucadata, unames, nfkc and the
big-endian ICU4J cnvalias, sent.brk and thaidict.dict) and a synthetic
inverse UCA file, and checks lengths, bytes, statuses and messages
against values taken from ICU 68.2, in-place swaps, round trips and
what the guest callbacks receive.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ICU stores an empty string as the resource word 0 and res_getString maps
it to a static empty string instead of reading pRoot[0]. The UTF-8
accessors read the length at pRoot[0], the root resource of the bundle.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
EVP_PKEY_CTRL_CMS_SIGN returns 1 like DIGESTINIT and PKCS7_SIGN.
EVP_PKEY_CTRL_CMS_ENCRYPT and CMS_DECRYPT return 1 like PKCS7_ENCRYPT
and PKCS7_DECRYPT, and on RSA-PSS queue
RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE and return -2, as in
LibreSSL 3.4.1 pkey_rsa_ctrl.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
X509V3_EXT_d2i threw NotImplemented for three common extensions that
LibreSSL 4.0.0 decodes. They now follow their templates:
- basicConstraints: SEQUENCE { ca BOOLEAN OPTIONAL, pathlen INTEGER
OPTIONAL } into the 16-byte BASIC_CONSTRAINTS of x509v3.h; ca takes
the content byte as it is;
- extendedKeyUsage: SEQUENCE OF OBJECT into a stack of ASN1_OBJECT;
- privateKeyUsagePeriod: SEQUENCE { [0] GeneralizedTime OPTIONAL,
[1] GeneralizedTime OPTIONAL } into PKEY_USAGE_PERIOD.
Refusals queue the errors of tasn_dec.c. X509V3_get_d2i and
X509_CRL_get_ext_d2i use the same table.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
i2d_X509 took the unused-bits octet from the ASN1_STRING_FLAG_BITS_LEFT
flags even when the BIT STRING was empty, so a certificate whose signature
or BIT STRING algorithm parameter was decoded from 03 01 05 re-encoded as
03 01 05. LibreSSL writes 03 01 00, since i2c_ASN1_BIT_STRING reads the
flags only when the length is positive. X509_digest follows i2d_X509.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move SonyLconv and its backing char arrays in SonyLocaleconv_nid_no_patch to thread_local storage and re-initialize all string buffers and fields to canonical C-locale defaults on every call.
Provide the three thread-state imports reported for Azahar in the
RetroArch inventory. The guest object and pthread key use the existing
libc and libkernel bridges.
Refs #5927
X509_sign signed the cached certificate-info encoding and then set the
inner AlgorithmIdentifier in memory only, so a certificate whose inner
identifier had the expected OID but not the parameter LibreSSL writes
(no NULL parameter, or another parameter) came back with the old
identifier in its DER and a signature over that old TBS. It now
rebuilds the TBS with the new identifier, signs that, and stores it as
the cached encoding; a cache that is not a TBSCertificate throws.
A certificate info signed with another signature algorithm still
throws, as before.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
LibreSSL 2.5.4 BN_bin2bn only clears top for an empty input, so a
negative ret becomes negative zero, and BN_add_word and BN_sub_word
return 1 without touching a when the word is zero. Both went through
Store, which cleared the sign of a zero result.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SSL_CTX_new and SSL_new resolve to libSceLibreSsl, whose 120-byte SSL_CTX
and 232-byte SSL keep their reference counters at offsets 32 and 168.
SSL_CTX_up_ref and SSL_up_ref incremented the LibreSSL 4.0.0 offsets 40
and 176 instead, so a retained context or connection was destroyed by the
first free and the retain overwrote a neighbouring field.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The DPP cases with row_shl:1 read the neighbouring lane of a 16-lane guest
row, so lane 7 reads lane 8. On a host whose subgroups hold fewer lanes
than the 32-lane wave (lavapipe with 8-lane subgroups) that lane is in
another subgroup and reads zero, and the test failed there. Skip the test
on such devices, as Dpp16Operands does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add StartPlayout, StopPlayout, StartRecording and StopRecording, toggling
the measured playing and recording flags with upstream's idempotent guards.
Correct the four declarations to void(WebRtcAudioDeviceBuffer*), matching
the void member functions they export. The task-queue statistics and
periodic logging around them stay unimplemented and are recorded in the
debt fragment.
Decode UTF-8 root lengths via std::u8string_view in TrimTrailingSeparators_nid_no_patch and classify missing parents beneath non-directory prefixes with NotFoundError_nid_no_patch in RenameDotError_nid_no_patch, with regression coverage in GuestDirectory.cpp.
guest_libc_internal_atomic_wait_deadline creates app0/eboot.bin in the
libSceLibcInternal test directory to exercise posix_spawn, and
guest_posix_spawn removes app0 there when it cleans up. When ctest runs
both at once, posix_spawn finds no executable and returns ENOENT instead
of throwing, and the deadline test aborts. Give the test its own working
directory, as guest_posix_spawn_optional_pid already has.
wpe_pasteboard_string_initialize and wpe_pasteboard_string_free are public
libwpe exports that still threw. They follow the LP64 descriptor, allocate-once
and clear-on-free contract of the bundled libwpe 1.14.0 source, allocating the
string data from the guest heap, copying through checked guest memory and
keeping errno.
Forward BIO_vfree to the parent library BIO_free and discard its result, as LibreSSL 4.0.0 bio_lib.c does, so titles that free a BIO through the deprecated name no longer throw.
Resolve a dotted object identifier or a built-in short or long name to an ASN1_OBJECT, following LibreSSL 4.0.0 obj_dat.c and a_object.c. Named results return the built-in table entry; numeric text produces an owned encoding that ASN1_OBJECT_free releases.
X509_CRL_get0_by_cert compared the certificate issuer with the CRL
issuer for every entry. LibreSSL 4.0.0 compares it with the names of
the entry's certificateIssuer extension, or of the nearest earlier
entry that has one, so the port answered 0 where the source answers 1
and the reverse on an indirect CRL.
GENERAL_NAMES are not decoded here, so the lookup throws
NotImplemented for such an entry.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Check `object->nid != 0` before `object->length == 0` in `LibreSsl3::ObjectNid`, matching LibreSSL 4.0.0 `OBJ_obj2nid` so OID-less `ASN1_OBJECT` entries with a non-zero `nid` and zero length do not resolve to `NID_undef` (`0`).
The previous commit wrapped sceKernelOpen's body in a lambda, so its
three log lines were tagged operator(). Set errno at each return
through File::KernelFileResult instead, after the logging, and let
RunKernelFileCall use the same helper.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fix three validation and concurrency bugs in libSceNpParty:
- Check GuestRangeIsZero(param, flagOffset + 1, 6) (0x2CA..0x2CF) instead of 0xCA..0xCF in the non-A branch of ValidateCreateParam.
- Always read data at dataOffset in the non-A branch of ValidateCreateParam and validate GuestBlobIsReadable(data, dataSize) whenever data != 0 && dataSize != 0.
- Store g_version and handler state before publishing g_initialized with memory_order_release in sceNpPartyInitialize, reset g_version in sceNpPartyTerminate, and load g_initialized with memory_order_acquire outside g_handlerMutex.
Validate UTF-8 continuation bytes step-by-step against Unicode Table 3-7 bounds in MsgDialog::DecodeUtf8 and advance by the valid maximal prefix length on failure.
Validate target paths upfront in savedata::replace_file_with and reject empty source/destination paths in savedata::move_replacing to prevent unwanted directory/temporary-file creation and callback invocations on non-file paths.
Define the 24-byte FreeBSD 11.4 amd64 _RuneEntry layout, add null-safe ActiveLocale() fallback and binary-search FindEntry(), and evaluate typeRanges, lowerRanges, and upperRanges for code points >= 256 in GuestRune::Is, towlower_nid_postfix, and towupper_nid_postfix.
Normalize (seconds, microseconds) without signed overflow, compute unsigned upward/downward headroom via std::make_unsigned_t<Clock::rep>, saturate before scaling, and handle full min()-to-max() spans cleanly.
Handle DecodeStatus::NotEnoughRoom before writing M4AAC BSI info, and on DecodeStatus::Ok copy PCM output before writing M4AAC BSI info so PCM size or pointer failures leave guest pBsiInfo untouched.
Follow feraiseexcept's host-safety guard in _Feraise_nid_postfix by throwing std::invalid_argument on bits outside Exceptions (0x3f) before modifying errno or x87/MXCSR state, and document the divergence in docs/dev/debt/changes/fix-libc-feraise-reject-unsupported-bits.md.
Guard param, src, dst, and out_length in ime_filter::FilterText via GuestCopyIn_nid_no_patch, GuestWritable_nid_no_patch, and GuestCopyOut_nid_no_patch, buffer output to prevent overlapping src/dst corruption and partial writes on fault, and bounds-check InCodepageA.
Track the path prefix length of an entered absolute symlink via frozenPrefix instead of a sticky boolean so symlink expansion stays suppressed at or below the symlink and resumes once .. ascends above it.
Sample clock->Now() when OpenUrlOnHost returns OpenUrlOutcome::Declined so modal confirmation dwell time does not shorten or expire OPEN_URL_DECLINE_COOLDOWN.
Share RunKernelFileCall through File.hpp instead of two copies, and
wrap sceKernelOpen, sceKernelClose and sceKernelLseek whole so errno
is set after their failure logging. guest_output_pointer_fault now
expects errno 14 from sceKernelReadv over an unreadable iovec array,
as the other sceKernel file calls set it; its checks that the copy
helpers keep errno are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WebCore::isPublicSuffix, WebCore::topPrivatelyControlledDomain and
WTF::String::simplifyWhiteSpace copied the StringImpl pointer in from
&string->impl. Forming that member access through a String pointer that
is not 8-byte aligned is undefined behaviour, and the Sanitizers nightly
stops nkwebkit_wtfstringargumentguestpointers on it: the test passes a
String four bytes before an unreadable page.
The pointer is now copied from the String's own address. impl is at
offset 0 (asserted in WtfStringAbi.hpp), so the bytes read are the same,
and a readable String at any alignment gives the same result as an
aligned one, as a plain x86-64 load of the guest object does. An
unreadable String still throws std::invalid_argument.
The test adds Strings at odd addresses in readable memory and checks
the results and reference counts for all three exports.
Take the recount of #24963 into the shared debt fragment: with one more stub gone from main, the count this branch sets is 119.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Both were untyped stubs of the 3.20 inventory. They need the URL parser,
which lives in libSceNKWebKit, so they go through the Jsc::ApiBridge:
- the complete-object constructor calls the base-object constructor
libSceNKWebKit already exports;
- setPassword is added to the ported URL class from WebKit c55364d5,
next to setUser.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
sceSystemServiceGetAppId and sceLncUtilIsAppLaunched read the title ID with strlen on the guest pointer, so an unreadable or unterminated title ID crashed the host instead of returning the documented -1.
Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
Copy the guest LP64 curl_httppost chain into host nodes that borrow its
pointers, then serialize it with the bundled curl and forward each chunk
to the guest append callback. Lengths and flags go through HostLong, so an
LLP64 host throws instead of truncating.
The SlistMime test serializes the forms built by curl_formadd, checks the
parts in order including a binary name and contents, and checks that a
short append returns CURLE_READ_ERROR.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YZ2PrBCgtD4myP8EufXgWo
For an empty facet slot, _Getcat builds a messages facet for the
locale's name with no references, as the (const char*, size_t)
constructor does, and it always returns 6, _X_MESSAGES in
microsoft/STL's xlocinfo, as xlocmes does. num_get (4) and time_get
(5) here use the same numbering. An empty slot with a null locale
throws. This replaces the throwing inventory placeholders 150 and 155.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An ASN1: value with SEQWRAP, SETWRAP, BITWRAP or OCTWRAP returned null without
an ASN1 reason when the modifier had no ':', and threw when it had one.
asn1_cb adds each of them as an explicit universal tag, ignoring any value, and
ASN1_generate_v3 puts these tags around the encoded value, the first one
outermost: a SEQUENCE or SET, or a BIT STRING with no unused bits, or an OCTET
STRING. They are now encoded that way, and a 21st one fails with
ASN1_R_DEPTH_EXCEEDED as append_exp does. IMP and EXP still throw with a ':'
and fail without one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The module's engine starts with setSkipIgnorableWhiteSpace on, so a new
or re-initialized DocumentBuilder drops white space that is a node's only
text. This library started with every option off and kept it as text
nodes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Format the time as WebKit's MediaTime::toString does: "{value/scale = seconds}"
for rational times, "{seconds}" for double-valued ones and ", invalid" for an
invalid time, with the seconds in ECMAScript shortest form.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YZ2Pr9YsGXAAFYYGoHAKFe
Adds APS5_DUMP_SPIRV=<hex code address>|all to write the final recompiled
module to spirv-<stage>-<address>.spv, mirroring APS5_DUMP_IR, to support
issue #18770: the exact PixelInterlockOrderedEXT module that drops an
ordered-interlock write on RADV GFX11 can now be run through a standalone
Vulkan harness on the affected hardware. Covered by agc_spirv_dump_tests.
A SET_*_REG packet or indirect register list with a 0xffffffff offset is accepted by the hardware and the rest of the packet still takes effect. The driver threw and lost the submission. registerOffset now reports the sentinel through an optional, and the validation range check, the direct write loop, the indirect pair loop and the indirect trace skip that entry.
A whole with a public and a private subobject of the destination type, in both base orders, is ambiguous for a source in a third base; with only the public subobject the cast still finds it.
The uniqueness of the destination was checked after the candidates were filtered by access, so a private second subobject of the destination left the public one as the only target. Every distinct destination subobject now counts, as in the GNU runtime, and the result reports the ambiguity in whole2dst.
A virtual base inherited publicly through one parent and privately through another is checked in both base orders, with a private-only hierarchy as the negative control and the -1 source-to-destination hint.
A source subobject reached through several routes, such as a virtual base inherited publicly through one parent and privately through another, kept only the last route's access, so a later private route erased the public downcast. The routes are now combined the way the destination candidates are.
Optional sampled formats now also need VK_FORMAT_FEATURE_TRANSFER_DST_BIT,
since texture uploads copy into the image, and guest format 137 (4_4,
R4G4_UNORM_PACK8) joins the list, so a device that lists no features
for it refuses the texture instead of creating an image it cannot use.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Implement the 3-tier packed ID hierarchy (libCtxId -> userCtxId -> requestId) and firmware 13.60 argument, lookup, and non-multipart validation across libSceNpWebApi2 user-context and request lifecycle exports, with updated GuestNpWebApi2 regression tests and a debt fragment.
Reject empty Report callbacks in Enqueue before locking, synchronize worker.request_stop() under mutex and serialize Finish() with finishMutex, and close file plus clear pending in run()'s catch (...) handler.
SdwaCvtOffSatPk expected the decoder to refuse neg and abs on the
v_cvt_off_f32_i4 SDWA source. The decoder now accepts them, and on RDNA2
hardware they leave the result unchanged: they only touch bit 31 of the
selected and extended source, and the instruction reads bits 3:0. The test
now runs the DWORD-destination cases with neg, abs and both and expects
the unmodified result. The v_sat_pk_u8_i16 refusals stay.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The RDNA decoder no longer throws for the DPP16 and SDWA neg and abs bits
on VOP1 and VOP2 opcodes whose sources are 32-bit integers. On RDNA2
hardware the bits flip, clear or set bit 31 of the operand after the DPP
lane move and after the SDWA select and extension, which is what
readOperand already does for 32-bit reads.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AudioBuffer::CopyFrom and CopyTo read the caller's stream config and
read or wrote the interleaved samples one by one through the guest
pointers, so an unmapped or read-only config or sample buffer crashed
the host. The config is now copied in once, CopyFrom copies its
num_frames * num_channels input samples in once before it changes the
buffer, and CopyTo interleaves into a host array and writes it with one
GuestCopyOut_nid_no_patch. A config or sample buffer that can't be
accessed throws std::invalid_argument, the result for a null one, and
errno is kept across the copies.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AudioFrame::muted, data, mutable_data, UpdateFrame and data_view read
and wrote the frame's fields through the guest pointer, and UpdateFrame
copied the caller's samples with memcpy, so an unmapped or read-only
frame or sample buffer crashed the host. Each field is now read with
GuestCopyIn_nid_no_patch and written with GuestCopyOut_nid_no_patch,
mutable_data clears a muted frame's samples with one copy, and
UpdateFrame copies the samples in once before writing them to the
frame. A frame or sample buffer that can't be accessed throws
std::invalid_argument, the result for a null frame. errno is kept
across the copies.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The font pipeline tests link a static Cairo copy beside libcairo's. On
Windows its critical sections start uninitialized, and the reference
helpers locked them through toy font faces and the scaled-font map before
any call initialized them, crashing the conversion and faces modes.
Initialize them at load, as Context.cpp does for libcairo's copy.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main now represents CairoFontFace handles as FontFace.cpp records, while
the font pipeline passed them to native Cairo as cairo_font_face_t.
cairo_scaled_font_get_font_face now returns one record per native face,
tied to the native face's lifetime through native user data, and
reference and destroy on it act on the native reference count.
cairo_scaled_font_create and cairo_set_font_face unwrap the record and
throw for FreeType faces, which have no native face.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Null font faces and matrices passed to cairo_scaled_font_create now
produce Cairo's native null-pointer error font, after the face-status
and font-matrix checks, instead of throwing. cairo_scaled_font_text_to_glyphs
validates its count outputs before the null-argument path writes them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
agc_driver_pointer_phi_lane_and_table and
agc_driver_pointer_phi_lane_not_table pair arms whose low word can be 0
with the record pointer's high word: lane_not_table's zero arm, and
lane_and_table's lane-mask arm in the waterfall pass over lanes 32-63.
When the records sit below 4 GiB, the selected pointer is then 0x0,
which faults as unmapped, as a null pointer does in
agc_driver_pointer_phi_sampler_table.
The records are on the test's stack. Since #18253, Windows test
executables link without high-entropy addresses, which keeps their
stacks near the bottom of the address space, and on a Windows RTX 4090
run both tests failed with "selected the descriptor at 0x0: unmapped".
Accept that fault only when the records' high word is 0; elsewhere
these arms still have to fault outside the snapshot.
CaseInsensitiveDirectoryWindows treated any failure of the FileCaseSensitiveInfo query as a case-sensitive directory. Hosts that cannot answer it look names up case-insensitively; Wine fails the query with ERROR_CALL_NOT_IMPLEMENTED. MatchNames then listed the whole directory for every lookup of a missing name instead of one FindFirstFileExW for that name. The errors a host gives for an unsupported information class now mean case-insensitive; other failures keep the previous behaviour.
FILTER_MODE 3 filters exactly like mode 0 on RDNA2, so decode it as a
weighted average, clear it to 0 in materialized direct samplers so the
min/max rules do not apply, and poison table samplers only for modes 1
and 2.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tools/suggest_patches.py reports a patch under the resolved catalog
path, but test_patch_advisor_json_integration.py expected the path as
written. With the build tree, and so the test's TMPDIR, behind a
symbolic link or a Windows junction the two differ and the test fails.
The test now expects the resolved path, as fernandomcrsilva proposed
in #22581.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011TXsSW8zeAgKgHLCFsYwM3
FreeBSD 11.4 keeps the listen backlog as `so_qlimit` and `sonewconn` drops a
connection once `so_qlen > 3 * so_qlimit / 2`, so a backlog of 0 completes
one connection and drops every later one while none is accepted. macOS does
not bound a `listen(0)` queue at one, so `guest_sce_net`'s connect-expiry
case completed 64 connects and never saw a pending one.
Each guest listener now counts its completed but unaccepted connections:
`sceNetListen` stores the backlog, `sceNetAccept` releases one, and a
blocking `sceNetConnect` with a connect timeout to a guest listener past
`3 * backlog / 2` follows FreeBSD's drop: it still lets the host complete the
connection into its own queue, waits the timeout, and reports `EAGAIN`, so
the guest sees the pending socket the console shows and the retry path keeps
returning `EADDRINUSE`.
The debt fragment records the bounds: a non-blocking connect, connections
from outside the guest socket set, a negative backlog clamped to FreeBSD's
default `somaxconn`, and the count resetting when the listener closes.
A title drawing a handed-out frame could have its buffer rewritten by
the decoder as soon as the next frame was handed out: with 2 or 3
output buffers no earlier handed-out frames were kept and free buffers
were reused newest first.
After the 4 optional decode-ahead framebuffers, request 4 more
optional framebuffers. When they are granted, keep at least the 5
newest handed-out frames intact and reuse free buffers oldest first.
When memory is short, the behaviour is unchanged.
TestPs5ExtendedInitLayout now expects the requested output buffer
count plus the decode-ahead and held pools. The memory-pressure cases
cover a partial and a full held-pool grant, and the handed-out frame
check runs with 2 and 6 output buffers.
Resolves the frame-buffer accounting question of issue #6898: the
output buffer count at 0x228 stays authoritative and the extra pools
are additive. The unknown console frame lifetime is recorded in the
libSceAvPlayer debt file.
The NpOnlineId, NpId, User, NpTitleToken and NpAccessToken constructors
and Clear methods, the NpAccessToken IsEmpty query, the NpOnlineId and User
comparison operators and the NpTicket accessors read and wrote the
caller's objects through the guest pointers, so an unmapped or read-only
object crashed the host. Each call now reads its sources once through
ReadGuest and writes the fields it sets with one
GuestCopyOut_nid_no_patch, leaving the struct padding as it was. An
inaccessible object fails through NotImplementedAt_nid_no_patch, as the
NKWebKit value classes do.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The report merged three reasons for a private variable's load into one:
a per-invocation value stored to it, a store through a per-invocation
pointer, or a store in divergent flow. Each variable now keeps the first
reason found, with the stored value's root or the store's block.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The spanned-wave check rejected a barrier in divergent flow by its block
alone, so a fallback in a title's log did not say which value made the
flow per-invocation. Each per-invocation value now keeps its root (a
varying built-in, an Input load, a private variable stored a
per-invocation value, a load of memory the shader writes with no barrier
before it, an atomic or subgroup result, a divergent phi, a call or a
parameter), and the report names the branch that splits the flow, its
condition and that condition's root.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The driver's rcp, rsq, sqrt, log2 and exp2 differ from RDNA 2 in the
last bits (rsq(2.0) is one ulp lower on an RTX 4090), so each result is
divided by its modifier's scale and compared with Float32ResultsAgree,
and v_cos_f32 within 2^-11. NaNs and signed zeros stay exact. The rows
at 2^-126, 2^126, exp2(-125) div:2 and exp2(128) are dropped, since a
device within those bounds can cross a flush or overflow edge.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The default v_rcp_f32 lowering is the driver's 1/x, which Vulkan allows
2.5 ulp of error. A result other than the RDNA 2 value now passes when
it is a normal value within that bound of the exact reciprocal, or a
signed zero when the bound reaches below 2^-126; a denormal result
still fails.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The driver's f64 rcp, rsq and sqrt are not required to be correctly
rounded, so finite results now match within 4 ulp while zeros,
infinities, NaNs and the denormal-or-normal class stay exact. The rows
whose exact result is the smallest normal or the overflow threshold
are dropped, since a device within that bound can land on either side.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RDNA2 applies mul:2, mul:4 and div:2 to v_rcp_f32, v_rcp_iflag_f32,
v_rsq_f32, v_sqrt_f32, v_log_f32, v_exp_f32 and v_cos_f32 whenever
IEEE mode is off, in every f32 denormal mode. The translation followed
the general rule, which drops the modifier when f32 output denormals
are kept, so those shaders lost the scaling.
Measured on gfx1036 with the hardware oracle; the new execution test
pins the rows for FLOAT_MODE 0xf0 and 0xc0 with IEEE off and 0xf0
with IEEE on.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RDNA2 reads a denormal input of v_rcp_f64, v_rsq_f64 and v_sqrt_f64 as
a zero of its sign when bit 0 of the FLOAT_MODE f16/f64 denormal field
is clear, and returns a zero of its sign for a denormal result when
bit 1 is clear. The translation kept both, so rcp of a denormal gave a
large finite value where the hardware gives infinity, and rcp of a
value above 2^1022 gave a denormal where it gives zero.
Measured on gfx1036 with the hardware oracle; the new execution test
pins the exact rows in all four f64 denormal modes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RDNA2 returns a zero of the result's sign from v_rcp_f32 and
v_rcp_iflag_f32 whenever the reciprocal is below 2^-126, in every
FLOAT_MODE f32 denormal mode and IEEE mode. The recompiler kept the
driver's denormal 1/x, so inputs above 2^126 in magnitude gave a
denormal where the hardware gives zero.
Measured on gfx1036 with the hardware oracle; the new execution test
pins those rows for FLOAT_MODE 0xc0 and 0xf0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Firmware 13.42 run in an emulator (issue #9277): request ids start at
0x20000001 and the lowest free one is handed out, a 33rd live request
is refused with 0x80550013, sceNpCreateAsyncRequest refuses a null
parameter (0x80550003) and a size other than 0x18 (0x80550011), and
Poll, Wait, Abort and Delete refuse a request id of 0 or less with
0x80550003. What Poll and Wait answer for a live request is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Build each draw packet in a host array and copy out only the words main
stored, so the writers no longer read the guest command buffer first. The
counted writers store their two spans around the untouched NOP word. The
padding words main never wrote stay untouched and need not be readable.
sceFontWritingInit cleared the caller's FontWriting with memset before
building the writing state inside it, so an unmapped record crashed the
host. It now clears it through CopyOutGuest, keeping errno, and an
unwritable record returns SCE_FONT_ERROR_INVALID_PARAMETER, as a null one
does, before anything is built in it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PollSleep created a high-resolution waitable timer per thread and never closed it. Use the
per-thread timer of PreciseWait, which is released with the thread; the 200 us wait is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Queue worker 0 evaluates its idle-epoch wait predicates under the driver
mutex and then blocks, with no timeout on the second wait. The last running
worker finishing (Running destructor) and a queue blocking in a memory wait
(noteWaitBlocked) incremented the epoch and notified without the mutex, so a
bump landing between the predicate check and the block was lost and queue 0
stayed asleep. Take the mutex around the increment; the notify follows it.
Neither call site can hold the mutex: both run during packet execution after
the worker released it, and noteWaitBlocked already locks it on another path.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
buffer_load_ushort and _sshort at an offset of 3 modulo 4 returned only the low
byte, because the load looked at one dword. RDNA2 (gfx1036, AMD Windows driver 32.0.21043.5001,
through the hardware oracle; IEEE 0, DX10 clamp 1, denorm32 0, denorm16 3, round32/16 0, fp16
overflow 0) returns both bytes whenever offset + 2 <= NUM_RECORDS. The second byte now comes from
the following dword, for every V# range.
BufferHalfStraddle pins ushort and sshort loads against 512 rows measured on that GPU, with
soffset, an immediate offset and a short range, in wave32 and wave64.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The rows for handle -1 ran before the guarded sceVideoOutOpen. Their
handle lookup starts the VideoOut driver, which throws on the main thread
on a runner without a Vulkan surface, so the Windows CI job aborted
instead of skipping. They now run after the open, with the other rows.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The device-lost hook installed by the VulkanDevice constructor was
written as `[captures] noexcept { ... }`. Omitting the parameter list
before a noexcept specifier is a C++23 feature, so GCC 15 and 16 warn
with -Wc++23-extensions under the project's C++20 mode. Writing `()`
makes the lambda valid C++20; the generated code is unchanged.
GuestModuleBuilder gated the provider-qualified binding name, the
executable-import rename and the provider BindingAliases behind !macos,
so two bundled modules exporting the same NID left macOS imports on flat
symbol lookup: a declared provider was not retained and an import needed
from two providers failed conversion outright (debt relinker entry 92).
The binding name and alias emission now cover macOS like Linux: the
executable's import is renamed to <nid>#moduleN and the named provider
module exports the matching <nid>#moduleN alias, which the macOS guest
writer emits as an extra Mach-O export (ordinary or TLS) so the dyld
flat-namespace bind of the aliased name resolves inside the declared
provider. Guest modules with a declared import module rename their
imports the same way. The multi-needed-provider conversion failure now
only triggers when no provider is declared, matching Linux, and the
Linux import/export type checks apply to macOS imports too. Linux
behaviour is unchanged: the widened conditions are equivalent there.
Evidence: new test_macos_guest_qualified_imports.py with the
qualified_import_fixture.py images converts twin providers through the
macOS writer and asserts the executable and consumer bind
_shared#module1#guest, both providers export the plain name plus their
own alias at the same RVA, an undeclared import with two needed providers
still fails with 'Ambiguous guest import', a single needed provider keeps
the flat name, and an OBJECT-typed import against a FUNC export fails the
now-enabled type check. linux_guest_qualified_imports, guest_symbol_names
and the macOS guest weak import/export tests pass unchanged; the full
relinker-only suite passes (948 tests).
Stream scans with a narrow character conversion parse each float field with the host's fscanf. macOS stdio reads 0 from '0x' and inf from 'infi' and leaves the rest for the next conversion, where the console (and glibc) end the field with a matching failure. Before the host scan, the stream source now looks ahead over the few characters such a prefix spans, pushes them back, and fails the conversion for an optional sign and 0x without a hex digit or point, or for infi not completed to infinity.
The sceFontOpenFont* exports read the caller's handle as a reuse hint and
stored results and nullptr through it in place, and the memory and file
forms read FontOpenDetail in place. Each body now runs on a host-local
handle through WithGuestHandle, which copies the handle in once and out
once, and the detail is copied in once; a bad handle or detail returns
SCE_FONT_ERROR_INVALID_PARAMETER, keeping errno.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sceFontGenerateCharGlyph cleared and stored the caller's glyph handle and
read the generate detail and its memory record in place, and
sceFontDeleteGlyph read and cleared the handle in place. They now use
CopyInGuest and CopyOutGuest, keeping errno; a bad handle, detail or
memory record returns SCE_FONT_ERROR_INVALID_PARAMETER before a glyph is
created or freed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sceFontRenderSurfaceInit, sceFontRenderSurfaceSetScissor and
sceFontRenderSurfaceSetStyleFrame read and wrote the caller's surface and
style frame in place. They now go through GuestCopyIn/GuestCopyOut and the
library's CopyInGuest/CopyOutGuest, writing only the fields they set and
keeping errno; SetStyleFrame returns SCE_FONT_ERROR_INVALID_PARAMETER for an
unmapped surface or frame.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sceFontGetScriptLanguage and sceFontGetTypographicDesign cleared their int
output straight through the caller's pointer, so an unwritable output
crashed the host. Both now clear it with CopyOutGuest, keeping errno; a
failed clear returns SCE_FONT_ERROR_INVALID_PARAMETER, as a null output
does, and earlier errors are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sceFontGetFontMetrics and sceFontGetFontStyleInformation computed straight
into the caller's output and cleared it in place on failure. They now read
the output into a local with CopyInGuest, compute into it and write it back
with CopyOutGuest, so untouched fields keep their bytes; an unwritable
output on a valid font returns SCE_FONT_ERROR_INVALID_PARAMETER.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sceFontMemoryInit and sceFontMemoryTerm used the caller's FontMemory in
place, and sceFontDestroyLibrary and sceFontDestroyRenderer read and
cleared the caller's handle in place. They now go through CopyInGuest and
CopyOutGuest and check writability before releasing anything; a bad record
or handle returns SCE_FONT_ERROR_INVALID_PARAMETER, keeping errno.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The sceFontStyleFrame calls read the caller's frame, and the setters wrote
its fields, in place, so an unmapped or read-only frame crashed the host.
Every call now reads the frame once with CopyInGuest, Init writes the
initialised frame in one copy, and the setters write only the fields they
change; a bad frame returns SCE_FONT_ERROR_INVALID_PARAMETER, keeping errno.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The trimmed entry had dropped the priority ordering rule (lower values first,
equal ones in arrival order) and the equal-thread-priority qualifier on the
attribute 2 measurement. Both are back; the entry is 985 characters.
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
On a PS5 (firmware 13.590.001), when the head of the queue times out with
tokens still free, the waiter behind it stays asleep until its own timeout,
and the token stays free. Measured for attributes 1, 2 and 0 with a 200 ms
head and a 3 s waiter: the waiter returned ETIMEDOUT 2950 ms after the
signal, and a poll of 1 afterwards succeeded.
The new check pins that behaviour. It fails on main, which wakes the waiter
at the signal, and passes with this change. The debt fragment records the
measurement, drops the unverified attribute 0 queue order (measured in queue
order), and is under 1000 characters.
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
The console masks the mode to 2 bits and the compare function to 3 bits
and clears the low bits of the compare address instead of rejecting them.
The remaining oracle mismatches come from stack arguments.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sceSdmaConstantFill and sceSdmaCopyWindowL2L validated their arguments
before Submit checked the handle, so a null, closed or unknown handle with
a nonuniform default-size fill or an out-of-range window reached
NotImplemented instead of returning SdmaErrorInvalidArgument.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sceImeDialogGetCurrentStarState stored the star state through the raw
guest pointer, so an unmapped or read-only state pointer crashed the
host process while a dialog was open. The value is now written with the
file's CopyOutPreservingErrno, and a failed copy returns 0x80bc0031, the
code the function already returns for a null state. The open dialog and
null checks keep their order, and errno is preserved across the copy.
sceVideoOutAddDisplayPositionEvent and sceVideoOutDeleteDisplayPositionEvent
threw on every call. They now take their firmware arguments and return
0x8029000b for a handle that is not open and 0x8029000c for a bad queue.
The delete returns 0x8029000d on a valid queue, since nothing is added;
the add throws where it would register, as the kernel side is unread.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
queryPendingWrite and QueryPendingSpan checked the queue-0 pipeline's queued
writes only when DrawPipeline::Active() was true, which is set only on the
queue worker. A draw handed to the draw finisher captured its memory with no
such check, so a capture over a range that an earlier queued item writes read
the bytes from before that write. The queries now check the queued writes on
the finisher thread as well: a capture over one drains the pipeline first and
a span query over one answers Sync.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Reject conflicts between a planned output file and a directory needed by another output during preflight. Writing the executable to a new app0 path previously left converted modules behind before failing.
Cover Linux and Windows output in write and dry-run modes with synthetic guest modules.
On a PS5 (firmware 13.590.001) a semaphore waiter that needs more tokens
than are available blocks the waiters queued behind it: with a waiter of 3
ahead of a waiter of 1, a signal of 1 woke neither and a poll of 1 still
succeeded, for the attributes 1, 2 and 0. sceKernelSignalSema passed over
the larger waiter and woke the later one. It now stops at the first waiter
it cannot satisfy.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The written-ahead test expected a dispatch that binds GDS to stop
resolveGroupAhead. Such a dispatch now writes the fixed GDS range, so the
dispatch after it is adopted ahead too. The unbounded stop is covered by a
dispatch that stores through a raw pointer instead.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A non-null handle that is not the address of an engine slot sceSdmaOpen
returns was dereferenced: an unmapped one crashed the process and a
readable one was used as a slot. Every handle entry point now returns
SdmaErrorInvalidArgument for it, as for a null handle.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Round each exact half product-sum of v_pk_fma_f16 and v_pk_fmac_f16 once
through the interpolation arithmetic in the f16 rounding mode, as packed
add and multiply do, following RDNA2 ISA section 12.10. With f16 results
flushed, a lane is tiny when twice its exact value, rounded in the mode,
is below 2^-13, the 11-bit unbounded-exponent test of packed multiply.
The reference in PackedFmaF16Rounding.cpp matches RDNA2 (gfx1036) on a
2,048-row hardware-oracle sweep of every f16 round, f16 denormal, IEEE,
DX10_CLAMP and FP16_OVFL mode; the test pins 256 of those rows.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019BnsKwjbZijNX2cctQKmrU
agc_driver_sdwa_destination_f32 also runs the seven ops on zeros,
denormals, infinities, NaNs and large values with f32 denormals kept and
flushed, against results measured on gfx1035 (Radeon 680M).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Screenshot::Take threw when removing the APS5_SCREENSHOT_TRIGGER file
failed, for example while another process still had it open on Windows,
and the throw aborted the title. A removal that fails is now reported once
and the trigger is tried again at the next frame; the screenshot is taken
once the file can be removed. A trigger that is not a regular file or
cannot be inspected still throws.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
When another process holds the APS5_SCREENSHOT_TRIGGER file open on
Windows, removing it fails and Screenshot::Take throws, which aborts the
title (a bot run ended that way after a screenshot request). The test
holds the trigger open, expects Take to return without a request and
without throwing, and expects the released trigger to be consumed at the
next call.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
agc_driver_image_packed_horizontal_gather checks the packed bitstream of
8_UNORM and 8_8_UNORM textures next to 8_8_8_8_UNORM, with three more
dmasks. The debt entry records that gfx1035 reads the last row for rows
past the height, where gfx1031 and the emitter return zeros.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On gfx1035 (Radeon 680M) a FORCE_DEGAMMA sampler reads 2_10_10_10 SNORM,
32_32_32 FLOAT, 5_5_5_1, guest format 141 and the 16-, 32- and 10-bit
integer formats bit for bit as without the bit, point and bilinear, so
they no longer throw. The 8-bit integer formats change and still throw.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bit 0 of each FLOAT_MODE denormal field keeps that precision's denormal
inputs and bit 1 its denormal result, so denormal modes 1 and 2 no longer
throw in v_interp_p1ll_f16, v_interp_p1lv_f16 and v_interp_p2_f16, and
v_interp_p2_f16 rounds by the f16 rounding mode. The f32 directed rounding
of v_interp_p1ll_f16 and v_interp_p1lv_f16 still throws.
Measured on gfx1035 (Radeon 680M) in all 512 float modes; pinned rows in
agc_driver_interpolation_modes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DispatchWriteRanges marked every BDA-ABI compute result unbounded, and every
GDS, page-table or fault-buffer binding as well, so a queue-0 dispatch with
those bindings always drained the draw pipeline instead of becoming a commit
item. The fault buffer and the page table are driver-owned, and a result
without a page table has no address table, so it cannot reach guest memory
through pointers. A result now stays unbounded only when it binds the page
table and stores through addresses (bdaWrites or the SPIR-V scan the driver
already uses). A GDS binding adds the fixed GDS range instead. The existing
rule that keeps fault-buffer-only results bounded (e2338d5bd1) is now part
of the general one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Firmware 4.03 disassembly shows a NpHeap is a single mspace handle and
a NpAllocator is a function-pointer vtable, and both families are thin
dispatchers:
- _sceNpHeapMalloc/Realloc/Free/Strdup/Strndup and the upgraded
_sceNpHeapMalloc stub forward to sceLibcMspace*; _sceNpMalloc,
_sceNpRealloc and _sceNpFree do the same over the global heap
- _sceNpAllocatorMalloc/Realloc/Free/Strdup/Strndup and the upgraded
_sceNpAllocatorMalloc stub call through the allocator function
pointers at offsets 0, 8 and 0x10 with the context at 0x18
- _sceNpMsgPackStrUtilIsValidUtf8String(WithSize) perform strict
UTF-8 validation; sceNpUtilNumChars counts characters and rejects
control bytes other than tab, line feed and carriage return
- sceNpJwsHs256GetEncodeSize returns ((size + 2) / 3) * 4 + 0x5e and
sceNpXmlParseInit zero-initialises the 0x268-byte parser context
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
In the 13.40 module both bodies are six bytes: mov eax, 0x809E0005; ret, with no
argument read, so the answer is the same for every input and matches the code
the rest of this library's immediate returns already return. The technical debt
entry now lists them with the others.
The new guest_abstract_youtube_trivial_returns test calls the whole immediate
return surface of the library, so the constants stay pinned.
A failed open leaves the stream with a null file, and closing it passed
that null file to the guest fclose. Close now frees the stream without
calling fclose when there is no file, and the test closes the
missing-file and invalid-mode streams through their Close slot.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The PKFactory CreateStreamFromFilename slot follows jxrlib's
CreateWS_File: it allocates the stream through WMPAlloc, wires the
FILE* callbacks and opens the file with the guest fopen, returning
WMP_errFileIO when the open fails. The stream's Close follows
CloseWS_File: guest fclose, then WMPFree.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#7395 now takes 79, above this PR's 66, so this PR takes 80, the lowest number above it that no open PR uses, and a cache written by another branch's recompiler is not read as this one's.
e94fb3f29d is #7395 with its merge of main after #7223. The two
conflicts are this branch's own changes over #7395: FormatVersion 66, and
its wording of the pointer-keyed image-table debt entry.
The deadline was computed as now plus the requested delay in unsigned
64-bit arithmetic. A delay close to UINT64_MAX wrapped to a deadline in
the past, so the callout ran at once instead of waiting. The deadline is
now clamped to UINT64_MAX.
The lead byte of a three-byte sequence ends one call, and the next call
brings a byte that does not continue it, followed by a closing quote.
The value must decode to the lead byte and the letter after it, the same
as when the input comes in one call.
When a multi-byte UTF-8 lead ends one call and the next call brings bytes
that do not continue it, the reader decoded the lead alone but still
reported all of the buffered and incoming bytes as consumed. The bytes
after the lead, including a closing quote, were skipped, so the string
never closed and its value was lost. The result depended on where the
input was split.
Report only the incoming bytes that the decoded character used, so the
rest is read again from the input.
The racing reader can stop before the sender's last datagram is readable,
as on macOS loopback. After both threads join, the test now reads each
remaining datagram while the read event reports it, checking its size, and
then requires the event to time out.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The peek event is created when a pool record is acquired, and a failed
WSACreateEvent is tried again on the next acquire instead of leaving the
record without an event.
- guest_socket_submitted_records checks that a failed preparation is retried
and the record then reused.
- guest_socket_submitted_record_tests links libc and configures Windows
unwinding like guest_socket_event_tests, so it links on MinGW.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A peek that WSARecv left pending stays reserved whatever
WSAGetOverlappedResult reports, and is reused only once
HasOverlappedIoCompleted reports it done.
- The pool moves to Socket/include/SubmittedRecords.hpp, and
guest_socket_submitted_records checks that a submitted record is not
handed out again before completion and is reused after it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- NextDatagramSize checks the cancelled peek with WSAGetOverlappedResult
without waiting, so Ready never waits under the equeue mutex.
- The OVERLAPPED, event and buffer live in a process-wide pool that is never
freed; a peek whose cancellation is still pending is reused only after
HasOverlappedIoCompleted reports it done.
- A completion that wins over the cancel reports its size; a failed
CancelIoEx leaves the peek parked.
- Test: a sender and a racing reader on one datagram socket while the read
event is polled; every reported size is 0 or 3.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- GuestSockets::Ready on Windows reads a datagram socket's next datagram size
with an overlapped MSG_PEEK receive, cancelled if it would wait, since
Winsock's FIONREAD reports 1 for a zero-length datagram.
- Adding an existing socket event again replaces its low watermark.
- A socket low watermark above INT64_MAX throws instead of being capped.
- A write event re-added on a pipe whose read end closed succeeds and replaces
its udata; EPIPE is kept for a new event.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A size of 1 set a watermark of 1, so a readiness with no data, such as
a zero-length datagram, no longer fired.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A size that does not fit in int64_t became negative and let every
readable or writable event through; it now caps at INT64_MAX, which
only end of file reaches. The tests drop the throw assertions for
unimplemented cases and run the pipe write path only where the host
reports pipe write readiness.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sceKernelAddWriteEvent takes the write end of a pipe, with EPIPE once
the read end is closed, and a size above 1 sets the low watermark of a
stream socket, as kevent already does for both.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The conflict in core/libs/prx/libSceAgcDriver/CMakeLists.txt from #12862's split is resolved with tools/agc_test_split.py resolve, which moves this PR's test registrations into tests/cmake/.
ShaderDiskCache's FormatVersion conflicts too, since #7395's merge brings 63. This PR's own format moves from 53 to 66, the lowest number above #7395's 63 that no open PR uses, in the stack's order, so its recompiler change keeps a disk cache format of its own.
Two checks expected resource planning to refuse a shape with "not a valid
runtime value": a high-word arm read from a buffer whose V# is loaded
through a pointer, and a record pointer arm whose two words are both
immediates. Such a check fails once the shape is supported, so both go.
The first was the whole of agc_driver_pointer_phi_high_second_table's
mode, so that mode and its registration go with it; the lane-mask,
high-word and second-lane cases stay.
The pointer walk skips an edge whose low word is an immediate, as a waterfall loop's Phi gives one beside the record column read. Where the pointer's two words are Phis of one block, an edge on which both are immediates is a constant pointer that no record holds, such as a null pointer, so the walk now refuses the column there instead of planning it.
The two words of the pointer are now walked edge by edge, and an edge
whose low word is a constant or a lane mask is skipped with its high
word. A high word read from a second buffer stays refused on an edge
whose low word is the record word.
The low and high words of a pointer-keyed record pointer were walked
separately, so a high-word arm on a path whose low word is a lane mask
refused the plan even though that pair is no pointer. Ratchet & Clank:
Rift Apart (PPSA01474) stops this way at LoadAddressU32@pc=0x9a30: one
high-word arm reads a second buffer, and on that edge the low word is a
lane mask, the waterfall loop reusing the SGPR pair.
Walk the two words together. Where both are Phis of one block, each
low-word edge takes the high word of the same predecessor. An edge whose
low word is a constant or a lane mask is skipped with its high word. A
record low word still needs every high word it can meet to be a constant,
a lane mask or the same record column at offset + 4, so a second-buffer
high word paired with the record word stays refused.
agc_driver_pointer_phi_high_second_lane_table adds the lane-mask low word
to the second-buffer arm: it plans, each group samples the T# its record
selects, and that arm faults outside the snapshot.
A pointer-keyed record pointer now also takes lane-mask ANDs, the
waterfall loop's lane bit and its OR and NOT forms, and a high word
merged from the record's next word. A high word read from a second buffer
stays refused.
A T# loaded through a record pointer was still refused with "GetImageResource
dword 0 is not a valid runtime value" when a Phi of the pointer's low word
merged the record read, a zero, and the waterfall's lane mask with the
handled lane's bit cleared, BitwiseAnd32(CompositeExtractU32x4(Ballot(...), 0),
BitwiseNot32(ShiftLeftLogical32(1, index))), as s_ff1, s_lshl and s_not with
s_and, or s_andn2, build it in the SGPR the pointer reuses. The walk took only
Ballot words and ANDs of them as lane masks, so it walked into the NOT and
refused.
A lane-mask operand is now a Ballot word or the loop's lane bit, a shift of 1
by an index from FindILsb32, FindUMsb32 or ReadFirstLane (through the AND,
add, subtract and select that s_ff1_i32_b64, s_bitset0 and the shift's own
mask put around it), or an AND, OR, NOT or Phi of only those and immediates.
An arm of the pointer that is entirely such an operand is skipped. An AND
with a record read in it still has the read matched against the column, and
anything else still refuses.
agc_driver_pointer_phi_lane_not_table builds that shape in a wave64
waterfall: the low word's Phis merge the record read at +0, a zero and the
lane mask without the handled lane's bit, cleared by s_not and s_and and by
s_andn2, and the high word is one read at +4. Each lane samples the T# of its
record, and every masked word faults outside the snapshot.
agc_driver_pointer_vsharp_select_table reads a record keyed by
ReadFirstLane(SelectU32(LogicalAnd, IAdd32, Phi)), a pointer from it, a V#
through the pointer and the T# through the V#; it passes without this change
and keeps that chain checked, including a record pointer moved to the other
V# without a recompile.
Shaders that planned before plan the same way, and a refusal is never cached,
so the disk-cache format does not change.
A T# loaded through a record pointer was still refused with "GetImageResource
dword 0 is not a valid runtime value" when the pointer's low word passed
ANDs with lane masks, as a waterfall loop that copies EXEC into the
pointer's SGPR builds them, or when its high word was a Phi of the
record's high word read under several keys.
For a pointer-keyed column, the walk of the low word now takes an AND
with a lane-mask operand (a Ballot word, or an AND or Phi of only Ballot
words and immediates) and keeps walking its other operand, so its
record reads must still match the column and anything else still
refuses. The high word is walked the same way: its record reads must
be the record word at the low word's offset plus 4. A high word that is
one read still gives the column its table and record offset, as before.
Otherwise the table comes from a record read whose V# words are defined
before the descriptor load, and the record offset from the high word,
which the GPU does not read for a pointer-keyed column.
A high-word arm read from another buffer, such as one whose V# is
loaded through a pointer, stays refused. A shader that planned before
plans the same way, so the disk-cache format does not change.
2026-10-21 05:39:59 +00:00
1771 changed files with 91217 additions and 7757 deletions
@@ -5,7 +5,7 @@ AnyPS5 relinks PS5 executables into native Linux or Windows programs that run ag
- No comments in code, except `#endif`, namespace ends, and the licence and copyright notice of code adapted from an upstream source (for example ICU or WebRTC). That notice stays verbatim at the top of the file, with a link to the pinned upstream commit. Attribution facts and known gaps still go in `docs/dev/debt/<library>.md`.
- An export you cannot implement calls `NotImplemented_nid_no_patch(__func__)`; never return a made-up success.
- Implement the function for every input. Never special-case a value, ID or path seen in one title's trace; if the general behaviour is unknown, throw and record it in `docs/dev/debt/<library>.md`.
- New third-party code is a submodule at `3rdparty/<name>`: add its `.gitmodules` entry (`git submodule add <url> 3rdparty/<name>`) and build it from source with CMake. Never `find_package` or copy sources in.
- New third-party code is a submodule at `3rdparty/<name>`: add its `.gitmodules` entry (`git submodule add <url> 3rdparty/<name>`) and build it from source with CMake. Never `find_package` or copy sources in, except for the system packages `tools/check_conventions.py` allows: `Python3`, `Threads`, `Git` and `LLVM`.
- Known gaps go in `docs/dev/debt/<library>.md`, added, changed or removed through a fragment in `docs/dev/debt/changes/` ([format](docs/dev/TechnicalDebt.md#fragments)); notes, reports and logs go in the pull request. Add no other files.
- Commit subjects and PR titles are Conventional Commits.
- PR body: copy [the template](.github/pull_request_template.md), keep every line, tick every box, and fill `What`, `Tested`, `Depends on` (#N or none), `Fixes` (Fixes #N or none), `Unblocks` (title ID and discussion, or none), `GPUs tested` (AGC, shader recompiler, VideoOut; otherwise n/a) and `AI-assisted` (yes or no).
- Follow the [coding conventions](docs/dev/CONVENTIONS.md): naming, no comments except [technical debt](docs/dev/TechnicalDebt.md), Conventional Commits.
- Every `APS5_*` or `ANYPS5_*` name a pull request adds to the code has a row in [docs/dev/ENVIRONMENT.md](docs/dev/ENVIRONMENT.md). A row for a name the pull request stops reading is removed. `tools/check_conventions.py` reports a violation as `env-reference`.
- **Every exported PS5 function with `APS5_VABI` must have exactly one declaration in a header reachable through the library's `<library>.hpp`. Duplicate declarations in headers, `.cpp` files and tests are forbidden. This is checked by the Python test [`public_headers`](core/libs/tests/test_public_headers.py).**
- Every function either does exactly what it is supposed to or throws. Unimplemented exports call `NotImplemented_nid_no_patch(__func__)` (see [libSceAudioIn](core/libs/prx/libSceAudioIn/Export.cpp)).
- Pull requests that add or change shader instruction semantics say where they come from: measured on hardware (which GPU and what was checked, e.g. with the [hardware oracle](docs/dev/HW_ORACLE.md)) or the exact source (ISA section, LLVM, ACO or Mesa file). Reviewers check the semantics on hardware. Cases the source doesn't settle throw, and behaviour not verified on hardware is recorded in [technical debt](docs/dev/TechnicalDebt.md).
@@ -90,7 +91,7 @@ The [pull request template](.github/pull_request_template.md) is the checklist f
Text in the repository is dry, strict and concise. Record known gaps, unknown NIDs and signatures in [technical debt](docs/dev/TechnicalDebt.md) instead of new files. An entry states the gap first (what differs from the console, what is unverified, what throws) and describes the implemented behaviour only as far as the gap needs it. A pull request that closes a gap removes its entry, or cuts it to what is still open, instead of rewriting it to describe the corrected behaviour. An entry goes in `docs/dev/debt/<name>.md`, named after the first `core/` path it links (`<name>` for `core/libs/prx/<name>/...`, otherwise for `core/<name>/...`), under the same `###` sections as the index; entries that link neither stay in the index. A pull request whose `TechnicalDebt.md` change conflicts after the split rebases and runs `python3 tools/debt_split.py resolve` during the stopped rebase, which moves its added, edited and removed entries to their files; `python3 tools/debt_split.py split` moves entries left in the index.
A link to a Markdown file with a `#fragment` must name a heading of that file, as GitHub writes its anchor: the text of the heading in lowercase, with punctuation removed and spaces turned into hyphens. The check reports a fragment that matches no heading (`doc-anchor`) in the lines a pull request adds; it does not check fragments that were already there.
A link to a Markdown file with a `#fragment` must name a heading of that file, as GitHub writes its anchor: the text of the heading in lowercase, with punctuation removed and spaces turned into hyphens. The check reports a fragment that matches no heading (`doc-anchor`) in the lines a pull request adds; it does not check fragments that were already there. A debt entry (a `- ` line in a debt file or fragment) longer than 1000 characters is reported as a warning (`debt-length`): shorten it to the gap, what is unverified, and what throws.
message(FATAL_ERROR"libyuv: ${CMAKE_SOURCE_DIR}/3rdparty/libyuv/source/scale.cc is missing; initialize the submodule with git submodule update --init 3rdparty/libyuv")
set_tests_properties(guest_hub_app_utilPROPERTIESTIMEOUT20PASS_REGULAR_EXPRESSION"\\[PPRBUG-22821\\] sceHubAppUtilDeeplinkToLiveDetailView\\(\\) is not available\\.")
set_tests_properties(guest_hub_app_util_ps_subscriptionsPROPERTIESTIMEOUT20PASS_REGULAR_EXPRESSION"\\[PPRBUG-22821\\] sceHubAppUtilDeeplinkToPSSubscriptions\\(\\) is not available\\.")
set_tests_properties(guest_hub_app_util_installation_statusPROPERTIESTIMEOUT20PASS_REGULAR_EXPRESSION"\\[PPRBUG-22821\\] sceHubAppUtilGetInstallationStatus\\(\\) is not available\\.")
check(acbSet==acb.words.data()+5&&dcbSet==dcb.words.data()+5,"set marker did not return its push packet");
check(acbSet==acb.words.data()+6&&dcbSet==dcb.words.data()+6,"set marker did not return its push packet");
check(acbSet[0]==Agc::Command::Header(0x10,2,0x0bu<<2u)&&acbSet[1]==0&&acbSet[2]==Agc::Command::Header(0x10,2,0x0cu<<2u),"ACB set marker is not a push and pop pair");
check(dcbPush==dcb.words.data()&&dcb.words==acb.words,"ACB and DCB markers differ");
check(unversioned.type==static_cast<std::uint8_t>(ShaderRegs::ShaderBinaryType::Gs)&&unversioned.code==versioned.code&&unversioned.shader_size==versioned.shader_size,"unversioned fusion did not return the fused program");
check(reinterpret_cast<std::uintptr_t>(unversioned.sh_registers)==reinterpret_cast<std::uintptr_t>(unversionedScratch.data()),"unversioned fused registers are not in the caller's memory");
check(std::memcmp(unversionedScratch.data(),versionedScratch.data(),unversionedScratch.size())==0,"unversioned fused registers differ from the versioned fusion");
std::fprintf(stderr,"[gpu] compute shader 0x%llx: its table call at program counter 0x%x cannot run its callees as their own pipelines: %s\n",static_cast<unsignedlonglong>(address),call.programCounter,refusal.c_str());
if(!GuestMemory::WriteWatched())throwstd::runtime_error("frame capture: the guest write watch is unavailable, so CPU stores during the frames cannot be recorded");
require(packet.size()>=3,"register packet has no values");
if(opcode==0x7a)require((packet[1]&0xf0000000u)==0||(packet.size()==3&&(packet[1]==0x20000243u||packet[1]==0x10000242u)),"indexed register bank selection is not implemented");
constautooffset=registerOffset(packet[1]);
require(packet.size()-2<=0x10000u-offset,"register range overflow");
if(offset.has_value())require(packet.size()-2<=0x10000u-*offset,"register range overflow");
if(!reported.exchange(true))std::fprintf(stderr,"[gpu] screenshot trigger cannot be consumed yet, trying again at the next frame: %s\n",error.message().c_str());
Require(static_cast<std::uint32_t>(report.reason)==0&&report.address==0&&report.bytes==0&&report.stage==0&&report.instruction==0&&report.claim==0,"BDA fault record has data without publication");
if(record.pagesOverflowed)Require(false,"the GPU stored to more pages of resident heap mirrors in one use than the "+std::to_string(record.pageSlots)+" store pages hold (APS5_BDA_STORE_PAGES)");
std::fprintf(stderr,"[gpu] loop guard: the loop exit at pc 0x%x of shader 0x%llx ran past %u evaluations\n",report.instruction,static_cast<unsignedlonglong>(report.address),report.bytes);
message<<"shader stage "<<report.stage<<": a split table call part resumed a lane whose s"<<report.bytes<<" holds 0x"<<std::hex<<(report.address&0xffffffffu)<<", but the part was compiled for the value 0x"<<(report.address>>32u)<<" that the program sets before the loop, because only callees write that register";
message<<"BDA store at 0x"<<std::hex<<report.address<<std::dec<<" ("<<report.bytes<<" bytes, instruction 0x"<<std::hex<<report.instruction<<std::dec<<") into a heap mirror found none of the "<<pageSlots<<" store pages free (APS5_BDA_STORE_PAGES)";
message<<"shader stage "<<report.stage<<": a relative write stored "<<report.bytes<<" in lane "<<(report.address>>32u)<<" of vector window slot "<<(report.address&0xffffffffu)<<", which holds a scalar spilled with v_writelane_b32 that a later v_readlane_b32 was replaced with";
Require(cause!=DepthReadCause::Access&&cause!=DepthReadCause::Write,"native multisample depth publication cannot distinguish an unwritten byte from a same-value guest store");
Require(found->hostFormat==base.format,"sampling several slices or an integer view of a depth plane that the device stores in another depth format is not implemented");
Require(stencil?HasStencil(found->hostFormat):found->hostFormat==base.format,"sampling several slices or an integer view of a depth plane that the device stores in another depth format is not implemented");
std::snprintf(text,sizeof(text),"AGC graphics: sampling the depth planes of depth surface 0x%llx (%ux%u, vk format %d) as a %ux%u texture of guest format %u (vk %d), dimension %d, %u slices, levels %u-%u, base slice %u is not implemented (last array %u, depth bits %d, copy format %d)",static_cast<unsignedlonglong>(base.address),base.extent.width,base.extent.height,static_cast<int>(base.format),resource.width,resource.height,resource.format,static_cast<int>(format),static_cast<int>(resource.dimension),layers,resource.baseLevel,resource.lastLevel,resource.baseArray,resource.depthOrLastArray,depthBits?1:0,static_cast<int>(copyFormat));
std::snprintf(text,sizeof(text),"AGC graphics: sampling the %s planes of depth surface 0x%llx (%ux%u, vk format %d) as a %ux%u texture of guest format %u (vk %d), dimension %d, %u slices, levels %u-%u, base slice %u is not implemented (last array %u, depth bits %d, copy format %d)",stencil?"stencil":"depth",static_cast<unsignedlonglong>(base.address),base.extent.width,base.extent.height,static_cast<int>(base.format),resource.width,resource.height,resource.format,static_cast<int>(format),static_cast<int>(resource.dimension),layers,resource.baseLevel,resource.lastLevel,resource.baseArray,resource.depthOrLastArray,depthBits?1:0,static_cast<int>(copyFormat));
throwstd::runtime_error(text);
}
std::vector<DepthPlaneSlice>slices;
constautogeometry=DescribeSurface(resource);
Require(!geometry.levelMajor,"depth planes of a PS4 layered surface with several mip levels (stored level by level) are not implemented");
Require(limit!=0u&&!state.depth,"mesh layer windows require a nonzero output limit and color-only layered rendering");
Require(std::ranges::all_of(shaders,[](constCompiledShader&shader){returnshader.program!=nullptr&&shader.program->layerReplaySafe;}),"mesh layer windows refuse shaders with guest memory writes, clocks or unproven side effects");
if(auto*recorder=Recorder::Active();recorder!=nullptr)requireDccRange(!recorder->PendingWriteOverlaps(range.address,range.bytes),range,"pending writes to a resident multisampled DCC target or its metadata are not implemented");
if(!GuestMemory::Accessible(reinterpret_cast<constvoid*>(use.address),static_cast<std::size_t>(bytes)))refuse(std::string("whose color memory ")+range+" is not mapped");
Require(entryPointId!=0,"fragment SPIR-V has no entry point");
Require(!earlyFragmentTests||!ShadersWriteMemory(std::span(&shader,1)),"early fragment tests with memory writes on a 16-bit depth target with stencil that the device stores in another depth format are not implemented");
AgcDriver::ProfilePrint_nid_no_patch("; validate: would emit %llu (%s) + %llu batch ends, would skip %llu; emitted/skipped by class:%s",static_cast<unsignedlonglong>(emitted),kinds.c_str()+1,static_cast<unsignedlonglong>(validateBatchEnds.exchange(0,std::memory_order_relaxed)),static_cast<unsignedlonglong>(skipped),classes.c_str());
}
AgcDriver::ProfilePrint_nid_no_patch("\n");
AgcDriver::ProfilePrint_nid_no_patch("[samples] occlusion dumps (cumulative): %llu queued (%llu inside an open pass), %llu recorded at once; %llu segments closed; %llu folds of queued dumps\n",static_cast<unsignedlonglong>(dumpsQueued.load(std::memory_order_relaxed)),static_cast<unsignedlonglong>(dumpsQueuedInPass.load(std::memory_order_relaxed)),static_cast<unsignedlonglong>(dumpsAtOnce.load(std::memory_order_relaxed)),static_cast<unsignedlonglong>(segmentsClosed.load(std::memory_order_relaxed)),static_cast<unsignedlonglong>(dumpFolds.load(std::memory_order_relaxed)));
AgcDriver::ProfilePrint_nid_no_patch("[samples] occlusion dumps (cumulative): %llu queued (%llu inside an open pass), %llu recorded at once; %llu segments closed; %llu folds of queued dumps, %llu at capacity\n",static_cast<unsignedlonglong>(dumpsQueued.load(std::memory_order_relaxed)),static_cast<unsignedlonglong>(dumpsQueuedInPass.load(std::memory_order_relaxed)),static_cast<unsignedlonglong>(dumpsAtOnce.load(std::memory_order_relaxed)),static_cast<unsignedlonglong>(segmentsClosed.load(std::memory_order_relaxed)),static_cast<unsignedlonglong>(dumpFolds.load(std::memory_order_relaxed)),static_cast<unsignedlonglong>(capacityFolds.load(std::memory_order_relaxed)));
if(storePageGatherLayout==VK_NULL_HANDLE)Check(context.Function<PFN_vkCreatePipelineLayout>("vkCreatePipelineLayout")(context.device,&layoutInfo,nullptr,&storePageGatherLayout),"vkCreatePipelineLayout store page gather");
module=CreateShaderModule(context,STORE_PAGE_GATHER_SPV,sizeof(STORE_PAGE_GATHER_SPV),"vkCreateShaderModule store page gather");
Check(context.Function<PFN_vkCreateComputePipelines>("vkCreateComputePipelines")(context.device,context.pipelineCache,1,&pipelineInfo,nullptr,&storePageGatherPipeline),"vkCreateComputePipelines store page gather");
std::fprintf(stderr,"[samples] %zu occlusion samples folded by a discarded batch are lost: no capacity was reserved to restore them\n",batch->foldedSamples.size());
}
for(auto&action:batch->discards){
try{
action();
}catch(conststd::exception&error){
std::fprintf(stderr,"[recorder] a discarded batch's discard action failed: %s\n",error.what());
}catch(...){
std::fprintf(stderr,"[recorder] a discarded batch's discard action failed with a non-standard exception\n");
if(name.empty())throwstd::invalid_argument("APS5_AB: an empty switch name in '"+std::string(ab)+"'");
constautofound=RuntimeSwitches::Find(name);
if(!found.has_value())throwstd::invalid_argument("APS5_AB: "+std::string(name)+" cannot change while the title runs; switches the A/B can change: "+FlippableList());
if(std::find(switches.begin(),switches.end(),*found)!=switches.end())throwstd::invalid_argument("APS5_AB: "+std::string(name)+" is listed twice");
if(token.empty())throwstd::invalid_argument("APS5_AB: an empty arm in '"+std::string(ab)+"'");
if(token=="A")return{"A",{}};
constautoequal=token.find('=');
if(equal!=std::string_view::npos){
constautoname=Trim(token.substr(0,equal));
if(name.empty()||name=="A")throwstd::invalid_argument("APS5_AB: an arm defined with '=' needs a name other than A in '"+std::string(ab)+"'");
if(std::any_of(name.begin(),name.end(),[](charc){return!std::isalnum(static_cast<unsignedchar>(c))&&c!='_';}))throwstd::invalid_argument("APS5_AB: the arm name '"+std::string(name)+"' may only contain letters, digits and _ in '"+std::string(ab)+"'");
for(constauto&arm:defined){
if(arm.name==name)throwstd::invalid_argument("APS5_AB: arm "+std::string(name)+" is defined twice");
if(config.phaseSeconds<1)throwstd::invalid_argument("APS5_AB: a phase must last at least 1 s");
autolist=ab.substr(colon+1);
if(Trim(list).empty())throwstd::invalid_argument("APS5_AB: no switch listed after the phase length");
for(;;){
constautoplus=list.find('+');
constautoname=Trim(list.substr(0,plus));
if(name.empty())throwstd::invalid_argument("APS5_AB: an empty switch name in '"+std::string(ab)+"'");
constautofound=RuntimeSwitches::Find(name);
if(!found.has_value())throwstd::invalid_argument("APS5_AB: "+std::string(name)+" cannot change while the title runs; switches the A/B can change: "+FlippableList());
if(std::find(config.switches.begin(),config.switches.end(),*found)!=config.switches.end())throwstd::invalid_argument("APS5_AB: "+std::string(name)+" is listed twice");
config.switches.push_back(*found);
if(plus==std::string_view::npos)break;
list=list.substr(plus+1);
constautolist=Trim(ab.substr(colon+1));
if(list.empty())throwstd::invalid_argument("APS5_AB: no switch listed after the phase length");
AgcDriver::ProfilePrint_nid_no_patch("[textures] sampled created: %llu from storage images, %llu cleared on the GPU, %llu uploaded on the GPU from host imports, %llu snapshots (%llu snapshot reads over recorded writes inside cachedTexture, %llu storage-path fallbacks); stage-A records %llu: %llu fast hits, %llu full lookups; storage images %llu hits, %llu created, %llu own-object refreshes; image tables %llu reused, %llu resolved; dynamic-resolution variants: %llu surfaces, %llu entries substituted, %llu entries rejected; %llu one-layer 2D array entries bound to the 2D texture of their surface; untracked snapshots %llu kept by the write-watch hint, %llu compared; views kept through a pending alias: %llu lookups, %llu revalidations\n",count(counters.fromStorage),count(counters.cleared),count(counters.imported),count(counters.snapshots),count(counters.pendingReads),count(counters.storageFallbacks),count(counters.records),count(counters.fastHits),count(counters.fastMisses),count(counters.storageHits),count(counters.storageCreated),count(counters.ownRefreshes),count(counters.tablesReused),count(counters.tablesResolved),count(counters.variantSurfaces),count(counters.variantSubstituted),count(counters.variantRejected),count(counters.arrayViewsShared),count(counters.untrackedKept),count(counters.untrackedCompared),count(counters.aliasViews),count(counters.aliasRefreshes));
AgcDriver::ProfilePrint_nid_no_patch("[textures] sampled created: %llu from storage images, %llu cleared on the GPU, %llu uploaded on the GPU from host imports, %llu snapshots (%llu snapshot reads over recorded writes inside cachedTexture, %llu storage-path fallbacks); stage-A records %llu: %llu fast hits, %llu full lookups; storage images %llu hits, %llu created, %llu own-object refreshes; image tables %llu reused (%llu found cached by the entry memo), %llu resolved; dynamic-resolution variants: %llu surfaces, %llu entries substituted, %llu entries rejected; %llu one-layer 2D array entries bound to the 2D texture of their surface; untracked snapshots %llu kept by the write-watch hint, %llu compared; views kept through a pending alias: %llu lookups, %llu revalidations\n",count(counters.fromStorage),count(counters.cleared),count(counters.imported),count(counters.snapshots),count(counters.pendingReads),count(counters.storageFallbacks),count(counters.records),count(counters.fastHits),count(counters.fastMisses),count(counters.storageHits),count(counters.storageCreated),count(counters.ownRefreshes),count(counters.tablesReused),count(counters.tableEntryMemoHits),count(counters.tablesResolved),count(counters.variantSurfaces),count(counters.variantSubstituted),count(counters.variantRejected),count(counters.arrayViewsShared),count(counters.untrackedKept),count(counters.untrackedCompared),count(counters.aliasViews),count(counters.aliasRefreshes));
}
// What the sampled-texture lookups on this thread proved their returned objects current against,
@@ -653,7 +654,10 @@ bool SampledFromStorageEligible(const Context& context, std::uint32_t format, st
Require(allocation.buffer!=nullptr&&!allocation.guest&&allocation.size==size&&size<=MaxRefreshBytes,"template data buffer cannot take the dispatch's words");
AgcDriver::Graphics::Require(byteLoops==1u&&rolled==1u,"the byte loop of write_bda_bytes may be unrolled, which copies its write lookup once per byte");
AgcDriver::Graphics::Require(nesting.has_value(),"a four-dword BDA read has no call from "+span+" to "+loader);
AgcDriver::Graphics::Require(*nesting==0u,span+" calls "+loader+" inside a selection or loop; NVIDIA's Blackwell driver then gives the lanes that take the dword path the results of other lanes");
Require(paged==0xa1b2c3d4u,"the store page of an unbound heap mirror block holds "+Hex(paged));
Require(std::all_of(pageBytes(*first),pageBytes(*first)+0x104,[](std::bytevalue){returnvalue==std::byte{0};}),"a store page holds bytes no store wrote");
Require(words(fault)[Abi::StorePageOverflowWord]==0,"one store page overflowed the store page table");
Require(stored.state==Abi::FaultState::Empty&&loaded==0x77777777u,"a read of an unbound block no store reached did not read its memory (got "+Hex(loaded)+")");
Require(slotOf(guest+0x10).has_value()&&!slotOf(guest+page).has_value(),"a read claimed a store page");
Require(stored.state==Abi::FaultState::Empty,"an unaligned store across two unbound pages published a fault");
Require(loaded==0xc3d40000u,"a read beside an unaligned store across two unbound pages returned "+Hex(loaded));
constautolow=slotOf(guest+page-2);
constautohigh=slotOf(guest+page);
Require(low.has_value()&&high.has_value()&&*low!=*high,"an unaligned store across two unbound pages did not claim a store page each");
Require(pageBytes(*low)[page-2]==std::byte{0xd4}&&pageBytes(*low)[page-1]==std::byte{0xc3}&&pageBytes(*high)[0]==std::byte{0xb2}&&pageBytes(*high)[1]==std::byte{0xa1},"an unaligned store across two unbound pages split its bytes wrongly");
Require(stored.state==Abi::FaultState::Empty&&loaded==0x5acdcdcdu,"a byte store into a copy-backed heap mirror did not reach its memory (read "+Hex(loaded)+")");
constautomaskSlot=slotOf(guest+2*page);
Require(maskSlot.has_value(),"a store into a copy-backed heap mirror claimed no store page");
Require(mask[0]==(1u<<0x13)&&std::all_of(mask+1,mask+Abi::StoreMaskWords,[](std::uint32_tword){returnword==0;}),"the store mask of a byte store holds "+Hex(mask[0]));
Require(std::all_of(pageBytes(*maskSlot),pageBytes(*maskSlot)+page,[](std::bytevalue){returnvalue==std::byte{0};}),"a store into a copy-backed heap mirror wrote its store page");
Require(stored.state==Abi::FaultState::Empty&&std::memcmp(masked.Bytes().data()+0x18,values.data(),sizeof(values))==0,"a four-dword store into a copy-backed heap mirror did not reach its memory");
Require(wide[0]==0xff000000u&&wide[1]==0xffu&&wide[2]==0,"the store mask of a four-dword store across two mask words holds "+Hex(wide[0])+""+Hex(wide[1]));
Require(stored.state==Abi::FaultState::Ready&&stored.reason==Abi::FaultReason::StorePages&&stored.address==guest+8&&stored.bytes==4,"a store finding no free store page did not fault");
Require(words(fault)[Abi::StorePageOverflowWord]==1,"a store finding no free store page did not mark the overflow");
Require(untouched(unbound,std::byte{0x77}),"a refused store reached the unbound block's memory");
Require(stored.state==Abi::FaultState::Ready&&stored.reason==Abi::FaultReason::StorePages,"a store into an unbound block without a store page table did not fault");
Require(untouched(unbound,std::byte{0x77}),"a store without a store page table reached the unbound block's memory");
Require(build(0,{})==first&&MirrorCounters().heapChecks==quiet.heapChecks&&MirrorCounters().sweeps==quiet.sweeps&&MirrorCounters().blocksCopied==quiet.blocksCopied,"an unchanged heap range was compared block by block or the mirrors were swept again");
guest[65536+9]=0x66;
Require(build(0,{})==first&&MirrorCounters().heapChecks>quiet.heapChecks&&MirrorCounters().blocksCopied==quiet.blocksCopied+1&&access.addressBytes(first)[65536+9]==std::byte{0x66},"a CPU write after an unchanged build was missed");
})==device&&guest[40]==0x78,"a writable heap mirror's second write-back lost the GPU's store");
guest[65536+1]=0x79;
Require(build(0,{})==device&&access.addressBytes(device)[40]==std::byte{0x78}&&access.addressBytes(device)[65536+1]==std::byte{0x79},"the writable heap mirror missed a store after a write-back");
registry(false,true);
sweep();
Require(MirrorCounters().heapMirrors==before.heapMirrors,"the writable heap mirror outlived its range");
Require(held.mirrors==1&&!(forceCopy&&resident),what+" was made where the address space limit forces a copy-backed one");
Require(!resident||held.bytes==bytes,what+" left a block of nonzero guest bytes unbound");
Require(guest[16]==0x77&&guest[16+8]==0x55,what+"'s write-back lost the GPU's store or rolled back the CPU's");
Require(build(0,{})==device&&access.addressBytes(device)[16]==std::byte{0x77}&&access.addressBytes(device)[16+8]==std::byte{0x55},what+" missed the stores");
})==device&&guest[40]==0x78,what+"'s second write-back lost the GPU's store");
guest[65536+1]=0x79;
Require(build(0,{})==device&&access.addressBytes(device)[40]==std::byte{0x78}&&access.addressBytes(device)[65536+1]==std::byte{0x79},what+" missed a store after a write-back");
Require(part->begin==cursor&&part->deviceAddress==device+cursor-address&&part->permissions==expected,what+" a program stores to through addresses is not writable in the BDA table with "+(resident?"plain Read|Write":"Read|Write|Masked"));
cursor=part->end;
}
Require(cursor==address+bytes,what+" a program stores to through addresses is not wholly in the BDA table");
Require(guest[16]==0x7c&&guest[1000]==0x7a&&guest[65536+2000]==0x7b,"an address store into "+what+" did not reach guest memory");
Require(guest[1000+8]==0x5b&&guest[40]==0x78&&guest[65536+1]==0x79,"the write-back of address stores into "+what+" rolled back a CPU store");
guest[65536+3000]=0x5c;
Require(build(0,{})==device&&access.addressBytes(device)[1000]==std::byte{0x7a}&&access.addressBytes(device)[65536+2000]==std::byte{0x7b}&&access.addressBytes(device)[65536+3000]==std::byte{0x5c},"a refresh of "+what+" reverted the address stores");
{
GuestBufferMemoryleased(context);
leased.AcquireRegistered();
leased.AllowAddressStores();
leased.AddWritable(address+16,32);
leased.Upload(true);
Require(!leased.AddressStoreSpans().empty(),"a program that stores through addresses into "+what+" has no store span");
Require(storing->HoldsFaultSlot()&&slotsHeld.slots==slotsBefore.slots+1&&slotsHeld.chunks==slotsBefore.chunks+1&&slotsHeld.held==slotsBefore.held+1,"a build that stores through addresses into "+what+" did not take a fault chunk of its own");
Require(slotsAfter.slots==slotsBefore.slots&&slotsAfter.chunks==slotsBefore.chunks&&slotsAfter.held==slotsBefore.held,"a destroyed build that stored through addresses into "+what+" left its fault chunk counted in the arena");
Require(BdaResources::FaultSlots(context.device).reclaimed!=reclaimedBefore,"fault slot pressure beside a build that stores through addresses into "+what+" reclaimed no idle slot");
Require(storing->HoldsFaultSlot(),"fault slot pressure reclaimed the private fault slot of an idle build that stores through addresses into "+what);
pressure.clear();
idle.clear();
storing.reset();
leased.WriteBack();
}
registry(false,true);
sweep();
Require(MirrorCounters().heapMirrors==before.heapMirrors,what+" outlived its range");
Loaded 100 of 1771 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.