Keeping Guest Memory Meaningful
A native system library cannot preserve a PS5-facing memory contract by forwarding every allocation to ordinary host heap functions. Title code may depend on aligned addresses, page protections, reservations, direct-memory mappings, and the ability to share the same backing with graphics. This chapter follows how AnyPS5 models those assumptions on Linux and Windows, and why memory becomes the bridge between native PRX behavior and Vulkan resource handling.
Why an ordinary host heap is not enough
A conventional heap answers a narrow question: give the caller a region of storage and later reclaim it. Console memory APIs answer more questions. Which virtual address is used? Is the range reserved but not committed? Which protection bits apply? Does the range refer to flexible memory or a particular direct-memory allocation? Can the same physical backing appear at more than one guest address? Can the graphics path observe writes made by the CPU, and can the CPU observe writes made by the GPU?
Those questions matter because title code can use addresses as part of its data model. A shader descriptor may contain a guest address. A module may query a mapping's extent or protection. A title may reserve a range before deciding when to commit it. A render target and a writable shader buffer must not accidentally alias in a way that changes the meaning of a draw. If the host implementation returned a convenient pointer but discarded these relationships, the title could pass simple startup tests and fail as soon as an address-based resource or synchronization path became active.
Direct memory makes the difference especially clear. The title can ask for a range associated with a physical offset and later map that range into its virtual address space. A host heap pointer has no corresponding physical identity that the rest of the guest API can query or remap. AnyPS5 instead keeps a record of physical pages, backing objects, virtual mappings, and protections so a later operation can refer back to the same allocation. The backing object is an implementation detail of Linux or Windows; the relationship between the guest mapping and the backing is the part the title can observe.
Flexible memory is less tied to a selected physical range, but it is not an untracked escape hatch. It still consumes a guest-visible range, has protections and ownership, and must be released through the corresponding path. The implementation keeps accounting for flexible ranges so “available memory” reflects what the title has actually reserved. This is the difference between adapting a guest API and simply translating its function names.
AnyPS5's direct-memory implementation therefore validates guest length and alignment rules, records reservations and protections, tracks physical pages and mappings, and translates guest protection bits into Linux or Windows protections. The exported libkernel functions expose direct allocation, direct and flexible mapping, virtual reservations, protection changes, virtual queries, and host-page locking. This is not an attempt to make host memory identical to console memory. It is an attempt to preserve the address and ownership relationships that title code can observe.
The distinction between reservation and commitment is especially important. A reserved range occupies an address interval without necessarily providing readable or writable storage. A committed mapping has backing and protection that title code may use. The implementation keeps records for those states so a later query or mapping operation can reflect the guest-visible lifecycle rather than reporting whatever incidental region the host allocator happened to choose.