fix(memory): a title's physical pages are numbered by their first 4 KiB frame, as the console numbers them #10
No reviewers
Labels
No labels
area: audio
area: d3d11
area: d3d12
area: gdk
area: gui
area: kernel
area: loader
area: shaders
area: video
area: winrt
bug
compat
console: series-xs
console: xbox-one
duplicate
enhancement
graphics-glitch
needs-log
needs-repro
not-a-dump
regression
status: boots
status: in-game
status: intro
status: menu
status: nothing
status: playable
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/sammwyy--xvalkyrie!10
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-10"
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?
@arugerdev on GitHub · 2026-11-23 21:02 UTC · original
arugerdev:fix/physical-page-frames→main· +97 −10 · 3 files · 1 commits · openXValkyrie gave a title's physical pages consecutive numbers, one per 64 KiB page (87120, 87121, ...). A title numbers physical memory in 4 KiB frames instead. Windows'
AllocateUserPhysicalPagesgives page frame numbers in system pages, and the console's kernel does the same, so a 64 KiB page is 16 frames: 87120, 87136, ...A title that only hands the numbers back never noticed. A later-kit Series title does arithmetic on them. It keeps each page's frame shifted right by 4, and shifts it back (
(v << 4) & 0x1fffff0) to map the page at another address throughXMemMapPhysicalPagesScatter. With consecutive numbers, 16 pages shifted down to the same value, so one physical page was mapped at 16 addresses at once. Whatever the title wrote at one of them appeared at the other 15. In that title this overwrote the shader code it had just read, and 1,215 of the 1,234 passes of its effects came out empty. It then stopped on a null pass, reading0x68, the crash other people report with that title.This change:
XMemMapPhysicalPages,XMemMapPhysicalPagesScatter,XMemFreePhysicalPagesand their kernelx names. A frame that is not the first of a page, or that is past the section, is refused as an invalid parameter, as a page past the section already was.Pages, sections and views are unchanged. A title that only passes back the numbers it was given maps the same pages as before.
Where it comes from
AllocateUserPhysicalPagesdocumentation: the page array is page frame numbers of system (4 KiB) pages.XMemMapPhysicalPagesScatteras(v << 4) & 0x1fffff0from a value it stored shifted right by 4.Testing
build.cmd --testpasses. A new case intests/memory.cppallocates pages, maps them, and maps two of them again from their numbers shifted right and left by 4, as the title does. It checks that each frame is a multiple of 16, that each page comes back with its own bytes, and that a frame within a page is refused. The case fails onmainand passes with this change.@arugerdev on GitHub · 2026-11-23 21:06 UTC · original
With this change the window stays open for about 12–15 s here, against about 6 s before. The title gets past the crash at
image+0xb5a5f8and reaches its audio setup, then stops when the host removes the Direct3D 12 device (DXGI_ERROR_INVALID_CALL), which this PR does not address.@sammwyy on GitHub · 2026-11-23 21:08 UTC · original
The next version of XValkyrie already has that fixed. Regardless, I’m going to evaluate your implementation.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.