cpu: test EXE startup through desktop shims #505

Merged
Jess-Doit merged 1 commit from upstream-pr/511 into main 2026-11-22 09:07:12 +00:00
Jess-Doit commented 2026-11-22 08:38:53 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Jess-Doit on 2026-11-22T08:38:53Z.


Change

Add cpu_native_shim_startup. The same source-built EXE and companion DLL run under Windows and pe_map with the existing desktop xmem.dll and d3d12_xs.dll providers. The test compares one process attach before entry, graphics memory allocation and observable release, the documented working-set failure, a tagged root signature with one preserved root-constant parameter, and exit status. The mapped run checks all six shim import requests and confirms host return.

Refs #132 and #165.

Verification

Tested aeb616a over 14e5456 on Windows 10 22H2 build 19045.6456, MSVC 19.44.35230, SDK 10.0.26100.0 and DXC 1.9.2602.17. All 16 selected CTests passed in Debug and all 16 passed in Release, including the new upstream two-provider comparison.

$targets = @(
    'cpu_shim_startup', 'pe_map', 'cpu_startup_exe', 'cpu_startup_b_noinit',
    'cpu_startup_a_alt', 'cpu_startup_exe_timeout', 'cpu_startup_exe_create',
    'cpu_exe_original_lifted', 'cpu_forwarder', 'cpu_crc_line_lifted',
    'cpu_crc_castagnoli_lifted', 'xmem_shim_check', 'd3d12_xs_shim_check',
    'cpu_exe_two_providers_lifted'
)
$tests = '^(cpu_native_(shim_startup|startup|exe_chain|exe_two_providers|exe_termination|forwarder|crc_line)|xmem_shim_.*|d3d12_xs_shim_.*|docs_links)$'
cmake --build --preset dev --target @targets --parallel 6
ctest --preset dev --no-tests=error --timeout 100 -R $tests -V

Repeat with --preset release. Both loaders emitted the same stage markers and returned 42. Withholding xmem.dll identified XMemAlloc. Withholding d3d12_xs.dll identified D3D12SerializeVersionedRootSignature. Both failures occurred before the EXE entered. Scratch variants that passed null to XMemFree or dropped the root parameter before serialization failed at the corresponding check under both loaders.

Evidence and follow-up

The companion and EXE are MIT-licensed source-built fixtures. The test records the EXE, companion and both provider digests for each configuration. See the EXE startup through desktop runtime shims section in docs/experiments.md.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I tested withholding each of the two providers.
  • I updated the experiment documentation.
  • The patch contains source and documentation only.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6540360107 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/511). Originally posted by [Jess-Doit](https://github.com/Jess-Doit) on 2026-11-22T08:38:53Z. --- ## Change Add `cpu_native_shim_startup`. The same source-built EXE and companion DLL run under Windows and `pe_map` with the existing desktop `xmem.dll` and `d3d12_xs.dll` providers. The test compares one process attach before entry, graphics memory allocation and observable release, the documented working-set failure, a tagged root signature with one preserved root-constant parameter, and exit status. The mapped run checks all six shim import requests and confirms host return. Refs #132 and #165. ## Verification Tested `aeb616a` over `14e5456` on Windows 10 22H2 build 19045.6456, MSVC 19.44.35230, SDK 10.0.26100.0 and DXC 1.9.2602.17. All 16 selected CTests passed in Debug and all 16 passed in Release, including the new upstream two-provider comparison. ```powershell $targets = @( 'cpu_shim_startup', 'pe_map', 'cpu_startup_exe', 'cpu_startup_b_noinit', 'cpu_startup_a_alt', 'cpu_startup_exe_timeout', 'cpu_startup_exe_create', 'cpu_exe_original_lifted', 'cpu_forwarder', 'cpu_crc_line_lifted', 'cpu_crc_castagnoli_lifted', 'xmem_shim_check', 'd3d12_xs_shim_check', 'cpu_exe_two_providers_lifted' ) $tests = '^(cpu_native_(shim_startup|startup|exe_chain|exe_two_providers|exe_termination|forwarder|crc_line)|xmem_shim_.*|d3d12_xs_shim_.*|docs_links)$' cmake --build --preset dev --target @targets --parallel 6 ctest --preset dev --no-tests=error --timeout 100 -R $tests -V ``` Repeat with `--preset release`. Both loaders emitted the same stage markers and returned 42. Withholding `xmem.dll` identified `XMemAlloc`. Withholding `d3d12_xs.dll` identified `D3D12SerializeVersionedRootSignature`. Both failures occurred before the EXE entered. Scratch variants that passed null to XMemFree or dropped the root parameter before serialization failed at the corresponding check under both loaders. ## Evidence and follow-up The companion and EXE are MIT-licensed source-built fixtures. The test records the EXE, companion and both provider digests for each configuration. See the EXE startup through desktop runtime shims section in `docs/experiments.md`. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I tested withholding each of the two providers. - [x] I updated the experiment documentation. - [x] The patch contains source and documentation only. AI-assisted.
upstream-sync closed this pull request 2026-11-24 06:43:26 +00:00
R0Y00 commented 2026-11-24 06:43:26 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T09:07:08Z.

Review: APPROVED


Reviewed aeb616a and reproduced cpu_native_shim_startup on Windows with main 1aafb0f. Native and mapped execution returned 42, all six provider imports were resolved, the mapped host returned and both missing-DLL controls failed before entry. This establishes the baseline for the separate compute/AOT follow-up.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6011428966 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/511#pullrequestreview-6011428966). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-22T09:07:08Z. **Review:** APPROVED --- Reviewed aeb616a and reproduced cpu_native_shim_startup on Windows with main 1aafb0f. Native and mapped execution returned 42, all six provider imports were resolved, the mapped host returned and both missing-DLL controls failed before entry. This establishes the baseline for the separate compute/AOT follow-up.
R0Y00 commented 2026-11-24 06:48:29 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T09:03:18Z.


@Jess-Doit, I am taking the AOT/compute follow-up to your startup fixture. I will reuse your EXE entry and companion DLL, preserve the two-loader controls in this PR, and keep the follow-up in a separate PR. The added comparison will run one D3D12 dispatch, compare import arguments, bytes, release counts and process status across native, pe_map and AOT, and inject an allocation failure. If you already have a related branch or a Windows 10 test case, please link it here so we can use it. Thanks for the reproducible baseline.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7076901174 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/511#issuecomment-7076901174). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-22T09:03:18Z. --- @Jess-Doit, I am taking the AOT/compute follow-up to your startup fixture. I will reuse your EXE entry and companion DLL, preserve the two-loader controls in this PR, and keep the follow-up in a separate PR. The added comparison will run one D3D12 dispatch, compare import arguments, bytes, release counts and process status across native, pe_map and AOT, and inject an allocation failure. If you already have a related branch or a Windows 10 test case, please link it here so we can use it. Thanks for the reproducible baseline.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!505
No description provided.