Repository navigation
RT-5: how the retail executable calls xmem.dll: all 23 XMemVirtualAlloc sites pass an attribute word the shim refuses - #6843
Etoile-Bleu wants to merge 1 commit into
Conversation
…oc sites pass an attribute word the shim refuses tools/import_call_sites.py finds an import's thunk and the call/jmp rel32 instructions that reach it, from the file alone. On game_scarlett_master.exe: XMemVirtualAlloc 23 sites (every attributes value nonzero, protections carrying PAGE_GRAPHICS bits), the physical-page family 21 sites with an AWE-shaped signature and 64 KiB pages, and the constants the other xmem imports are called with. docs/xmem_exe_calls.md records them and what is still unmeasured.
|
Independent CPU-only check of
This checks the byte scanner’s candidate boundaries and import targets. The argument constants were outside the scope of this check. AI-assisted. |
shayderrr
left a comment
There was a problem hiding this comment.
Summary
Adds tools/import_call_sites.py and its test suite (thunk discovery via PE32+ import tables, call/jmp rel32 counting, JSON output, 32-bit refusal) plus docs/xmem_exe_calls.md and a README row. The doc reports per-import call-site counts for the retail executable's 12 xmem.dll imports: all 23 XMemVirtualAlloc sites pass a nonzero attributes word that runtime/shims/xmem.cpp rejects, five use the 2 MiB page mode, and six carry unknown allocation bits. It infers the AWE-style physical-page signatures and a 64 KiB page unit, and lists constants for XMemAlloc, XMemFree, XMemTransferMemory and XMemGetWorkingSetStatistics.
Why merge
Core static-recompilation input: explains why the xmem shim rejects every real allocation and what shape a replacement needs. Synthetic tests and docs only, no game data.
Verdict: Approve
SummaryAdds Why mergeCore static-recompilation input: explains why the xmem shim rejects every real allocation and what shape a replacement needs. Synthetic tests and docs only, no game data. Verdict: Approve |
|
Tested dfcc046 on Windows 11 Pro 10.0.26100, Python 3.14.3 (CPU-only change, no GPU involved): pass Independent check on my own copy of the same executable (SHA-256 No game code was executed; only counts and constants were read. AI-assisted (opencode). |
|
Closing: this PR's three files ( |
Claimed in the coordination issue as: #6603 (RT-5, claim posted at the time of this PR)
@ItsNotRexed third exe PR, after #6715 and #6751.
Depends on: none. Related, not overlapping in files: #6709, #6814, #6733, #3390, #4531, #3601 (all change
runtime/shims/xmem.cpp; this PR does not).What and why
The executable imports 12 functions from
xmem.dlland 7 have no shim. Several open PRs are filling that in, so this measures, from the file alone, how the executable calls them:tools/import_call_sites.py(new, withtests/test_import_call_sites.py): finds an import's thunk and thecall/jmp rel32instructions that reach it, from a PE32+ file, and prints counts or RVAs. It reusespe_inspect.PeImage. The test builds a PE byte by byte (calls, a tail jump, an unused import, an ordinal import, a 32-bit image, the CLI and its exit code 2).docs/xmem_exe_calls.md(new, one index row indocs/README.md): the counts and the constant arguments, and what is inference and what is unmeasured.What it shows:
XMemVirtualAlloccall sites pass a nonzeroattributesword (0x3,0x7,0x21,0x23,0x27,0x181,0x183,0x283), andruntime/shims/xmem.cppreturnsERROR_NOT_SUPPORTEDfor any nonzero value. Past that check, 5 sites use the 2 MiB mode (0x20003000) and 6 carry allocation-type bits the shim does not know (0x4000,0x40000). Theirprotectvalues carry the SDK'sPAGE_GRAPHICS_*bits (0x2004=PAGE_READWRITE+PAGE_GRAPHICS_READWRITE).XMemMapPhysicalPages12,XMemAllocatePhysicalPages4,XMemFreePhysicalPages3,XMemMapPhysicalPagesScatter2). Their shape is the Win32 AWE family's, with 64 KiB pages; the page lists the inferred signatures and marksXMemFreePhysicalPagesas the least certain. It also records that the first function using them needsXMemVirtualAllocto accept the attribute words first.XMemAlloc,XMemFree,XMemTransferMemoryandXMemGetWorkingSetStatistics, and that the0x5e50000attributexmem.cppmentions is not among theXMemAllocsites that pass a constant.No code of the executable is quoted, only counts and the constants a call passes.
Tested
Own Xbox 1.0.2.1 package plus the executable (SHA-256
e95020b2fa4a721db3df59fdecf75621730ac559d8835252f6c3b658d5a08993), Windows 11 26200, Python 3.13,main1cc6e3c1. Nothing was run from the executable.python -I tools/import_call_sites.py game_scarlett_master.exe --dll xmem.dll --dll d3d12_xs.dll --dll xg_xs.dll: 17 imports, 67 call sites, 1 s. The counts match an independent scan I made first (XMemVirtualAlloc23,XMemMapPhysicalPages12,XMemAllocatePhysicalPages4,XMemFreePhysicalPages3,XMemMapPhysicalPagesScatter2).python -I tests/test_import_call_sites.py: 8 tests OK.tests/test_pe_inspect.py(60),tests/test_ci_registration.py(14) and all 11tests/test_docs_*.pyOK.AI-assisted: yes
Checklist
docs/design.md, with how it was confirmed. (not a translator change)