Repository navigation
Conversation
…ry reads Serve the Xbox DirectStorage API (IDStorageFactoryX2, IDStorageQueueX2, IDStorageFileX, IDStorageStatusArrayX) under dstorage_xs.dll, xcrdapi.dll and dstorage.dll. Declarations are our own (shims/dstorage_xs_abi.h), written from the public GDK reference; layouts are pinned with static_asserts. - OpenFile goes through the registry's kernel32!CreateFileW, so GAME: paths use the console path mapping and the write overlay. GetHandle returns a ReOpenFile handle with its own file position. - One worker thread per queue runs submitted entries in order: file and memory requests, status arrays, ID3D12Fence::Signal, EnqueueSetEvent (on a duplicate of the title's handle taken at enqueue). - Auto-submit at half the capacity (or disabled through DSTORAGE_QUEUE_OPTIONS), enqueue into a full queue waits, CancelRequestsWithTag (a cancelled request is a success and not a failure), error record and error event, Close and the last Release drain the queue, IDStorageFileX::Close waits for the file's submitted reads. - Request checks: reserved bits, source type, BCPack/swizzle ranges, sizes, 1 GiB limit, null and foreign objects and closed files (also for zero-size requests), end of file, inaccessible memory. - zlib, BCPack, swizzle and physical pages return E_NOTIMPL (later PRs). - Interface ids of the X interfaces are not public: a creating call accepts and logs a new id per object kind, but refuses system COM ids (IMarshal, IAgileObject, ...) and the PC DirectStorage ids; QueryInterface accepts only IUnknown, the PC IDStorageStatusArray id (same shape) and the ids creating calls accepted for that kind. Bad arguments are logged once per method. - registry.cpp classifies xcrdapi.dll!DStorageGetFactory as HRESULT; the cl.exe fallback in build_runtime.ps1 builds the new shim too. ctest dstorage: 258 checks over synthetic files in %TEMP%, no GPU, no game data. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/directstorage.md records which DLL and ABI the console title is expected to use (dstorage_xs.dll medium, xcrdapi.dll and dstorage.dll low confidence), what is not public (vtable order, interface ids, some constants) and the choice made for each, what owning the modules shadows at run time, what the shim does (including the order of its request checks), and what later PRs add (zlib, BCPack, swizzle, physical pages, GPU-backed destinations, parallel reads). Index row in docs/README.md; the owned-module list in runtime_imports.md and the shim list in runtime/README.md name the new modules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # scripts/build_runtime.ps1
…mit, /EHa under clang-cl Review fixes for ItsNotRexed#4348 (Flyander, AirKyzzZ): - DSTORAGE_REQUEST allows a buffer over 32 MiB only with 64 KiB or 2 MiB pages, which are not implemented yet, so such a request now fails with E_DSTORAGE_REQUEST_TOO_LARGE before any memory is touched. - TotalRequestCount and the byte totals grow when a request is submitted, not when it is enqueued, and PendingRequestCount counts the request the worker is processing (DSTORAGE_PRIORITY_STATS). - dstorage.cpp is built with /EHa under clang-cl, so guarded_move's __try catches an access violation in a title's buffer there too. Tests: an over-limit and an at-limit 32 MiB copy, and stats checked before Submit and while a copy is held on a guard page. The three new failing checks fail with the previous shim. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # scripts/build_runtime.ps1
# Conflicts: # scripts/build_runtime.ps1
# Conflicts: # scripts/build_runtime.ps1
Pause the worker on a read from a PAGE_NOACCESS source and restore access in the vectored exception handler. Wine can consume PAGE_GUARD during this copy without calling the handler. The test now observes the pending request before it releases the worker. Verified with Wine 11.20 on the DirectStorage base and the zlib follow-up. AI-assisted.
|
I ran the registered The timing fixture checked the request count before submission, one additional pending request while the 4,096-byte copy was held, and a return to baseline after completion. Both versions passed that sequence on this machine. The parent failure reported in the PR was observed under Wine 11.20. I ran |
|
✅ Automated security review: CLEAN (commit
Scope: static analysis of added diff lines only; no code was executed. Please review findings manually. |
LaugeM
left a comment
There was a problem hiding this comment.
This is the fix to use for the Wine failure in test_stats_timing, and it belongs in #8461, the takeover of #4348. bc2e03e still merges onto #8461's head 077606cb4 with no conflict (git merge-tree), although that head changed dstorage_test.cpp. Depends on: should name #8461 now that #4348 is closed.
On native Windows it passes merged onto #8461: MSVC (VS 2026, x64), 280 checks, 0 failures. I have no Wine here, so whether the PAGE_NOACCESS hold fixes the Wine case rests on your run and @jeanklann's diagnosis on #8461 (the guard exception never reached the vectored handler).
#7763 fixes the same failure differently, with a LEONIDA_DSTORAGE_TEST_HOOKS hook in runtime/shims/dstorage.cpp and dstorage_xs_abi.h. It is compiled only into dstorage_test, but it puts test code in the shim. This PR touches only the test, which is better.
#7180 and #7652 have the same test_stats_timing, so they pick the fix up when they rebase onto #8461.
AI-assisted review (Opus 5.5). Read the diff against main; built dstorage_test with MSVC merged onto #8461 and ran it (280 checks, 0 failures).
Claimed in the coordination issue (#7231 comment).
Depends on: #4348. The DirectStorage test is introduced in that PR. This follow-up adds one commit on top of
45c39cf6:bc2e03e.What changed
On Wine 11.20, the memory copy in
test_stats_timingcan clearPAGE_GUARDwithout delivering the exception to the test's handler. The worker finishes the copy before the test samplesPendingRequestCount.The test now sets the source page to
PAGE_NOACCESS. Its handler accepts only a read fault within that page, restores read access, and waits for the test to release the worker. This retains the before-submit, pending, and after-completion checks.Verification
CachyOS x86-64, Wine 11.20, synthetic inputs. I built the test with clang/llvm-mingw and compiled the runtime's SEH copy function separately with clang-cl /EHa.
Each patched configuration passed five consecutive runs.
scripts/check_no_game_data.pyandgit diff --checkpassed. Native Windows was not tested. AI-assisted.