AnyPS5/core/libs/prx/libc/include
raghav314 be1f501525 fix(agc): import GPU-mapped guest memory when it is mapped
The registry calls an observer on the mapping thread, after the registry
lock is released, with the ranges a kernel mapping gave GPU access:
direct and flexible maps with it, and fixed remaps with it over a
registered range (a reservation). The mutation looks them up while it
still holds the lock and hands them over weakly, with the registry
generation it ended at, so the observer does not keep a range alive.
The driver imports those ranges on its current device, so an
address-based build finds the import instead of pinning the memory on
the queue that first uses it. A range that gains GPU access through
sceKernelMprotect, and AnyPS5's own libc heap, are still imported on
first use.

The import at map does not reconcile the other imports with the
registry, so its cost does not grow with the number of imports. It skips
a range that is gone, and any range when the imports were reconciled
with a newer registry since; the next lookup imports those as before.
It installs the pin waiter as the other import paths do, so unmapping a
range imported at map retires its import. The live import bytes are kept as a
running total instead of being summed over every import. Once the import
table belongs to the current device the import takes only the table's
lock; the first import on a device (which runs the write-watch probe)
and a device that was just replaced go through the GPU lock. Clearing
the observer waits for calls already running.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 00:23:23 +02:00
..
exceptions fix(libc): export the C personality to guest code 2026-10-08 13:16:41 +03:00
general fix(libc): define APS5_LOG_OUT_DEBUG when APS5_DEBUG_LOG is set 2026-10-09 13:42:51 +02:00
specifics Merge pull request #1435 from ewraj/fix/linux-guest-varargs 2026-10-08 15:52:17 +02:00
ApplicationHeap.hpp feat(libc): implement malloc_stats_fast through the application allocator 2026-10-09 11:04:45 +05:30
CpuTopology.hpp perf(agc): pin the queue workers to the performance cores on Linux 2026-10-05 21:23:34 +13:00
FileStream.hpp fix(libc): open fopen and freopen paths through the wide CRT on Windows 2026-10-10 21:23:30 +13:00
FilesystemError.hpp refactor(libkernel): share one rename implementation with libc 2026-10-08 23:17:04 +02:00
General.hpp fix(libc): stop strtol at a 0x prefix without hex digits on Windows 2026-10-10 23:40:19 +02:00
GuestAllocations.hpp fix(agc): import GPU-mapped guest memory when it is mapped 2026-10-11 00:23:23 +02:00
GuestArena.hpp fix(guest-arena): place guest address space in the PS5 window on Linux 2026-10-10 22:56:07 +13:00
GuestDirectory.hpp feat(libc): translate guest directory enumeration 2026-09-25 06:41:55 +10:00
GuestHeap.hpp feat(libc): implement RaiseEv, catchReturnFromMain and reallocalign 2026-09-30 23:55:00 +00:00
GuestLocale.hpp feat(libc): implement collate<char>::_Getcat 2026-10-06 14:53:47 +02:00
GuestTime.hpp fix(libc): convert times into the guest's 56-byte tm on Windows 2026-10-10 02:13:17 +02:00
GuestWriteWatch.hpp fix(agc): host imports write-protect only pages a collect already protects 2026-10-10 11:38:28 +05:30
HeapDiagnostics.hpp feat(libc): implement heap trace info 2026-09-27 11:43:36 +03:00
HostThreadLocal.hpp fix(agc): preserve recorder buffers through Windows thread teardown 2026-09-28 09:55:01 +10:00
PreciseWait.hpp fix(audio): pace blocking audio calls with a high-resolution timer 2026-10-10 01:31:57 +02:00
Shutdown.hpp fix(libc): end the process without detach routines in _Exit on Windows 2026-10-10 21:20:29 +13:00
WindowsFormatting.hpp fix(libc): format guest wide printf arguments on Linux 2026-10-08 21:15:04 +02:00
WindowsMappings.hpp fix(libc): check a whole range before collecting its writes with reset 2026-10-09 10:36:55 -05:00
WindowsScanning.hpp fix(libc): translate Windows fscanf guest arguments 2026-10-06 13:45:10 -07:00