dstorage: requests into physical pages write the title's pages (RT-DSTORAGE-DEST-PAGES) #969

Closed
github-bot wants to merge 1 commit from gh-pr/969/head into gh-pr/969/base
Owner

@⁠DadaCap on GitHub · 2026-11-24 16:02 UTC · original
DadaCap:dstorage-dest-pages → main · +155 −7 · 6 files · 1 commits · closed without merging

Claim: RT-DSTORAGE-DEST-PAGES (#14).

A DirectStorage request with DestinationIsPhysicalPages runs into a staging buffer and its bytes then go to the 64 KiB pages XMemAllocatePhysicalPages gave out (rt::xmem::write_physical_pages), so every address they are mapped at sees them. Until now it answered E_NOTIMPL.

The page array is read when the request runs, not at enqueue. The retail title passes a pointer into its own page table: at enqueue the entries are 0, and they are filled by the time the request runs. Measured on 1.0.2.1 (in my prototype stack): with a copy taken at enqueue nearly every such request named page 0; read late, no request failed in a 240 s run that reaches the loading screen.

The xmem shim is called through a pointer, as dstorage_test does not link it; without it such a request stays E_NOTIMPL. Physical-page sources stay E_NOTIMPL (none has been seen).

Tested

  • dstorage_test: 341 checks, 0 failures (new: the table filled after enqueue, the offset, three pages, a page that is not live, a null and an unreadable array). xmem_test: 220 checks OK (new: writes across pages, into uncommitted ones, bad page numbers). Windows 11, MSVC, Release-with-debug-info, on main.
  • Retail package: only in my prototype stack, not on this branch alone (RTX 5080, driver 621.24, Windows 11).
  • No game data.

AI-assisted (Claude Code, Opus 5.5).

🤖 Generated with Claude Code

**@⁠DadaCap** on GitHub · 2026-11-24 16:02 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/969) `DadaCap:dstorage-dest-pages` → `main` · +155 −7 · 6 files · 1 commits · closed without merging Claim: RT-DSTORAGE-DEST-PAGES (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14). A DirectStorage request with `DestinationIsPhysicalPages` runs into a staging buffer and its bytes then go to the 64 KiB pages `XMemAllocatePhysicalPages` gave out (`rt::xmem::write_physical_pages`), so every address they are mapped at sees them. Until now it answered `E_NOTIMPL`. **The page array is read when the request runs, not at enqueue.** The retail title passes a pointer into its own page table: at enqueue the entries are 0, and they are filled by the time the request runs. Measured on 1.0.2.1 (in my prototype stack): with a copy taken at enqueue nearly every such request named page 0; read late, no request failed in a 240 s run that reaches the loading screen. The xmem shim is called through a pointer, as `dstorage_test` does not link it; without it such a request stays `E_NOTIMPL`. Physical-page **sources** stay `E_NOTIMPL` (none has been seen). ### Tested - `dstorage_test`: 341 checks, 0 failures (new: the table filled after enqueue, the offset, three pages, a page that is not live, a null and an unreadable array). `xmem_test`: 220 checks OK (new: writes across pages, into uncommitted ones, bad page numbers). Windows 11, MSVC, Release-with-debug-info, on `main`. - Retail package: only in my prototype stack, not on this branch alone (RTX 5080, driver 621.24, Windows 11). - No game data. AI-assisted (Claude Code, Opus 5.5). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The page array is read when the request runs: the retail title passes a pointer into its own live page table.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:30:59 +00:00
github-bot closed this pull request 2026-11-26 09:30:59 +00:00
Author
Owner

@⁠Snooozs on GitHub · 2026-11-24 17:39 UTC · original

Independent check: dstorage and xmem pass (dstorage_test, xmem_test rebuilt). I checked the page-count arithmetic: DestinationPageOffset is a UINT16 here, so offset + size cannot wrap and the copied page list always covers what write_physical_pages reads. With #968 there is a textual conflict in runtime/shims/xmem.h only (both add a hook at the end of the namespace).

Windows 10 Pro 22H2 (19045), VS 2022 RelWithDebInfo, merged onto main 32950551e without conflicts, targets rebuilt, CPU only, no game files. AI-assisted (Claude Code): I read the whole diff and ran this on that machine.

**@⁠Snooozs** on GitHub · 2026-11-24 17:39 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/969#issuecomment-7139513432) Independent check: `dstorage` and `xmem` pass (`dstorage_test`, `xmem_test` rebuilt). I checked the page-count arithmetic: `DestinationPageOffset` is a UINT16 here, so `offset + size` cannot wrap and the copied page list always covers what `write_physical_pages` reads. With #968 there is a textual conflict in `runtime/shims/xmem.h` only (both add a hook at the end of the namespace). Windows 10 Pro 22H2 (19045), VS 2022 RelWithDebInfo, merged onto `main` 32950551e without conflicts, targets rebuilt, CPU only, no game files. AI-assisted (Claude Code): I read the whole diff and ran this on that machine.
Author
Owner

@⁠DadaCap on GitHub · 2026-11-25 02:40 UTC · original

Closing this one: #984 brought another implementation of the same thing to main, and it covers the case this pull request was written for.

  • main's dstorage.cpp resolves a request's physical page numbers in xmem when the request runs (rt::xmem::transfer_physical), not when it is enqueued. That is the point of this branch too: the retail title passes a pointer into its own live page table, whose entries are still 0 at enqueue.
  • This branch now conflicts with main in 5 files (dstorage.cpp, xmem.cpp, xmem.h, dstorage_test.cpp, docs/directstorage.md) and adds nothing main lacks, so a merge would only put a second path beside the first.

The claim RT-DSTORAGE-DEST-PAGES can be dropped from the table. AI-assisted (Claude Code).

**@⁠DadaCap** on GitHub · 2026-11-25 02:40 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/969#issuecomment-7151030449) Closing this one: #984 brought another implementation of the same thing to `main`, and it covers the case this pull request was written for. - `main`'s `dstorage.cpp` resolves a request's physical page numbers in xmem when the request runs (`rt::xmem::transfer_physical`), not when it is enqueued. That is the point of this branch too: the retail title passes a pointer into its own live page table, whose entries are still 0 at enqueue. - This branch now conflicts with `main` in 5 files (`dstorage.cpp`, `xmem.cpp`, `xmem.h`, `dstorage_test.cpp`, `docs/directstorage.md`) and adds nothing `main` lacks, so a merge would only put a second path beside the first. The claim RT-DSTORAGE-DEST-PAGES can be dropped from the table. AI-assisted (Claude Code).

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.