agc_driver_host_import_lifetime takes the settle alias path only on a
device whose graphics family has a single queue, such as AMD's Windows
driver; elsewhere the settles share the graphics family and make no
alias. agc_driver_host_import_lifetime_other_family runs the same tests
with the settles forced onto another queue family, as
agc_import_settle_deferred_other_family does, so a device with spare
graphics queues covers that path too. It is registered on Windows and
skips where the device has no other queue family.
forgetSettle handed back an import's settle batch only while the batch
was still running. A batch the GPU had finished but that had not been
reaped yet still held its aliases, so retireImport released the import
at once, freeing its memory before the alias bound to it was destroyed.
Hand back any busy batch. The import then stays with its batch until
the batch is reaped or an unmap releases it, and both destroy the
aliases first. A finished batch now keeps its imports' Vulkan objects
until it is reaped (#7601).
On Windows a host import under 1 MiB is settled by a batched 4-byte
read. When the settle queue is in another queue family than the
import's, as on AMD's Windows driver with its single graphics queue,
the batch reads through an alias buffer bound to the import's memory.
Reaping the batch destroys those aliases before it drops the imports
retired while the batch held them.
An unmap that needs such an import (releaseSettleRetired) waited for
the batch and then released the import, destroying its buffer and
freeing its memory while the alias was still bound to that memory; the
alias went at the next reap. Destroy the batch's aliases first, as
reapSettleBatches and drainSettles do.
sceSslConnect verifies the server's chain under MBEDTLS_SSL_VERIFY_OPTIONAL and returns the first failure the connection's verify options select, with the SSL_ERROR_* codes KytyPS5 lists. The initial options are all five checks, so a connection whose title never sets them fails closed: with no CA loaded it returns SSL_ERROR_UNKNOWN_CA instead of throwing. The result is final for the connection: a failure sends close_notify, later sceSslConnect calls return the same code, and sceSslRead and sceSslWrite throw. A verify callback runs once after the handshake, outside the session lock, with the connection id, that code, handles to a copy of the peer chain that the context's certificate readers accept, the chain length and the user argument; a negative return fails the connect with SSL_ERROR_APPLICATION_VERIFICATION_CALLBACK_CHECK. The ALPN list set with sceSslSetAlpn is split on commas and offered, sceSslGetAlpnSelected returns the protocol the server chose, and the minimum version floors the handshake at TLS 1.2. A socket that would block returns SSL_ERROR_WANT_POLLIN or WANT_POLLOUT from connect, read and write and the next sceSslConnect resumes the handshake; the BIO maps a reset to MBEDTLS_ERR_NET_CONN_RESET, which returns SSL_ERROR_SOCKET_CLOSED, and tells a blocking socket's expired receive timeout, which returns SSL_ERROR_READ_TIMEOUT, apart from a non-blocking would-block. sceSslClose sends close_notify once and marks the connection closed. The debt entry records the default options and the situation-to-code choices as unverified and drops the title IDs.
Repacked copies and depth stencil copies allocated device-local memory
directly and stopped the title on a refusal; they now take the same
allocation path as the other images. Device buffers choose their host
fallback type the same way, the host placement line carries the cumulative
MiB, and the debt file records that a placed image stays in host memory
for its lifetime.
Textures, storage textures, block, depth and depth plane copies and
attachments now share one allocation path: the pool trims its idle tiers,
releases the texture caches, retries device-local memory and places the
image in host memory only when that retry is refused too. Block and depth
plane copies no longer fall back on their first refusal.
Render, depth and multisampled targets and attachment proxies that the
driver refuses device memory now go through the buffer pool's recovery:
the pool releases its idle allocations and the attachment is retried in
device-local memory. Only a second refusal places it in host memory, and
that placement is logged with the bytes reclaimed.
Depth targets, depth plane copies, multisampled and render targets, block and
depth copies and attachment proxies allocated device-local memory without the
fallback, so a full device-local heap still stopped the title at them.
The budget check in DeviceMemoryType trusts VK_EXT_memory_budget, which lags
behind the driver: with the device-local heap nearly full the budget can still
report room, the allocation fails with VK_ERROR_OUT_OF_DEVICE_MEMORY, and the
title stops. Device buffers (after the pool's reclaim and retry), textures and
storage textures now retry in a host memory type allowed by their requirements.
Resolve the docs/dev/debt/relinker.md conflict with #5994: keep its
sce_module syscall-scan entry, which now also stops at the end of the
last unwind function when the PLT comes before the code (it calls the
same FindSceCodeEnd), and its /libexec/ld-elf.so.1 start in the code
analysis entry, with this PR's end for a PLT before the code.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Windows deferred preinit thunk pushed r12, r13 and r14 and then
popped r12, r13 and r14, so the caller got r12 and r14 back swapped.
InitializeDeferredModule keeps the module base, table and count live
across the call to the thunk, so a compiler that keeps any of them in
r12 or r14 sees corrupted loader state after opening a deferred module
that has a preinit array. Pop in reverse push order instead and pin the
new bytes in test_guest_preinit.
guest_preinit loads the instrumented guest_module_args_host.prx into Python, so in an ANYPS5_ENABLE_ASAN build it needs the same verify_asan_link_order=0 as the other module tests; without it, it fails with "ASan runtime does not come first in initial library list". add_asan_test_options does nothing outside ASan builds.
Signed-off-by: Ayamullah Khan <[email protected]>
Converted guest modules never ran their DT_PREINIT_ARRAY entries: the
reader validated the array and the unused-NID filter kept its targets,
but no writer emitted or ran it. ld.so runs a shared object's preinit
array only for the main executable, so the Linux output runs the
entries from the DT_INIT stub before the module initializer; the macOS
and Windows outputs run them before the initializer in their startup
stubs, and the deferred Windows output exports a thunk that runs them
before the initializer for runtime-loaded modules. A module with a
preinit array and no initializer is still rejected, since the Linux
stub exists only with one.
Four tests printed a value with std::to_string after "0x", so a decimal number
read as a hex one. The anchor of a differing anchored BDA read, guest + 0x100,
was reported as 0x140733498786049 instead of 0x7fff12340101. They now print
these values in hex.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The SPIR-V emission failures printed the shader hash with std::to_string
after "hash=0x", so the hash read as a hex number that was the decimal one.
Shader 0x1173ae1000 was reported as hash=0x74955231232. Both now print it in
hex, as the driver's own messages print the shader address.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
main replaced g_outputMutex with g_outputMutexes[], so the Sys close no longer compiled. Mirror sceAudioOutExClose: range-check the handle, lock its mutex.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
guest_gameupdate still asserted the throw that sceGameUpdateGetAddcontLatestVersion
no longer raises for a null entitlement label since it answers 0x80412803, so the
test aborts; it now asserts the error, the same change #5919 makes. The mastering
states layout is pinned with compile-time size checks for the descriptors, the
compressor and limiter states and both states structs, as #6380 suggested.
libSceCesCs goes to 17 of 17: three-byte EUC-JP JIS X 0212 (0x8F)
characters convert through a table read from the Unicode consortium's
JIS0212.TXT, both directions, so sceCesEucJpToUcs2, the MbcsStrTo*
and *Get*Len forms and the context conversions accept them, and a
character with cells in both JIS X 0208 and JIS X 0212 still encodes
to the two-byte form. sceCesRefersUcsProfileCp1250 returns a profile
with the Windows-1250 table of Microsoft's bestfit1250.txt, accepted
by the SBC and context conversions.
The AudioOut HDMI bitstream Sys family follows the Ex ports: SysOpen
opens a port only for mode 5, the TrueHD MAT route EVO-PLAYER-PS5
reads from the firmware 12.70 mode tables, paced at 192 kHz with no
host device; SysConfigureOutput accepts the observed HDMI MAT switch;
SysClose closes a Sys port. sceAudioOut2MasteringGetState fills the
states by states id with the descriptors KytyPS5 declares, SetParam
answers a null parameter with the mastering invalid-API-parameter
error, Set3DLatency follows KytyPS5's output validation (0x80268001
above 2, any user), SetSystemDebugState records the debug state id,
and GetSpeakerArrayCoefficients returns the front pair KytyPS5 and
prosper both return.
sceAudioInOpen accepts param 0x10 as float mono like KytyPS5; HqOpen
answers a longer grain or a lower rate with the invalid-size and
invalid-frequency errors; AsyncOpen also accepts the 384-sample grain
SharpProspero documents. sceGameUpdateGetAddcontLatestVersion answers
a null entitlement label with 0x80412803, as prosper does.