hle(host_posix): file mappings are unimplemented, so a title that maps a data file reads nothing #619
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T15:37:07Z.
Summary
host_posix/files.rsanswered the file calls a title makes withCreateFile/ReadFile, but nothing for the ones it makes when it maps a data file instead of reading it:CreateFileMappingW,OpenFileMappingW,MapViewOfFile(Ex),FlushViewOfFileandUnmapViewOfFilewere all unimplemented, so they landed in the loader's import stub and a title that maps its archives would read nothing.The interesting part is not the calls but where the view's memory comes from. Every reader of title memory here - the GPU's page table (
xmem_physical), the descriptor readers, the tracing - knows the rangesVirtualAllocmade and nothing else, so a hostmmapof the file would be invisible to them. A view is therefore title memory holding a copy of that part of the file, made with onepreadat the mapping, and a write-through view's bytes go back withpwriteatFlushViewOfFileorUnmapViewOfFile, clamped to what the file had.What the change does
CreateFileMappingW: a section over a file (its size, or the caller's), or over the pagefile forINVALID_HANDLE_VALUEand a size. A name handed out twice is the same section withERROR_ALREADY_EXISTS, as Windows reports it;OpenFileMappingWfinds it by name.MapViewOfFile/MapViewOfFileEx: a view at an offset that must be a multiple of 64 KiB (ERROR_MAPPED_ALIGNMENT),0bytes meaning the rest of the section, refused withERROR_ACCESS_DENIEDwhen it would write a section created read-only. Past the file's end the view is zero, as a view's last page is.UnmapViewOfFilefrees a view's own memory; a pagefile view is part of its section and is freed with it.Tests
Five new ones in
files.rs: a view holds the file at its offset and survives the section handle closing; a write view writes through on flush and on unmap without growing the file; the refusals and their error codes; the pagefile section zeroed, shared between two views and found by its name; and a section's views seen throughOpenFileMappingW.Why it matters
A title that maps a data file instead of reading it gets its bytes, and the GPU can read the same addresses, because the view is title memory like any other.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T15:37:15Z.
/claim
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-28T15:37:25Z.
Claimed by @AnastasisKon. Open a draft pull request with
Refs #619in its description within 24 hours, or the claim expires.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T16:31:41Z.
Merged with the PR that serves these calls; closing.