cpu: recompile a source-built EXE entry through a named DLL import #225

Merged
R0Y00 merged 1 commit from upstream-pr/228 into main 2026-11-21 18:50:39 +00:00
R0Y00 commented 2026-11-21 18:48:23 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T18:48:23Z.


Closes #210. Refs #165.

The source-built x64 EXE reads one selector byte at its CRT-free PE entry. The translator follows the entry's relative call into the existing MASM caller, resolves its named IAT slot against the existing mix_args provider, and emits both functions as C++. Windows launches the native fixture and the translated program in separate processes.

Input Arguments received by mix_args Output bytes Process exit
00 0x100000303, 0xfffffffd 11 03 00 00 00 00 00 00 0x60d
01 0x30, 0x06 35 00 00 00 00 00 00 00 0x57

The Windows CTest compares each native result to the table and each translation to its native reference. A second assembly build changes the selector from JZ to JNZ. Translating it swaps the expected arguments, output bytes and exit status on both inputs. Empty stdin returns 2 with empty output streams across all four programs.

Reproduced locally with:

cmake --build --preset dev --target cpu_exe_original_lifted cpu_exe_inverted_lifted
ctest --preset dev --no-tests=error -R '^cpu_aot_exe_entry$' -V

Thanks to @yummancito for the native child-process baseline in #165. This fixture reuses the existing public call_mix and mix_args sources and the 0x60d reference exit. The generated EXE uses the host C++ startup. #165 continues to cover mapped process startup and TLS.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6532948442 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/228). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-21T18:48:23Z. --- Closes #210. Refs #165. The source-built x64 EXE reads one selector byte at its CRT-free PE entry. The translator follows the entry's relative call into the existing MASM caller, resolves its named IAT slot against the existing mix_args provider, and emits both functions as C++. Windows launches the native fixture and the translated program in separate processes. | Input | Arguments received by mix_args | Output bytes | Process exit | | --- | --- | --- | --- | | 00 | 0x100000303, 0xfffffffd | 11 03 00 00 00 00 00 00 | 0x60d | | 01 | 0x30, 0x06 | 35 00 00 00 00 00 00 00 | 0x57 | The Windows CTest compares each native result to the table and each translation to its native reference. A second assembly build changes the selector from JZ to JNZ. Translating it swaps the expected arguments, output bytes and exit status on both inputs. Empty stdin returns 2 with empty output streams across all four programs. Reproduced locally with: ```powershell cmake --build --preset dev --target cpu_exe_original_lifted cpu_exe_inverted_lifted ctest --preset dev --no-tests=error -R '^cpu_aot_exe_entry$' -V ``` Thanks to @yummancito for the native child-process baseline in #165. This fixture reuses the existing public call_mix and mix_args sources and the 0x60d reference exit. The generated EXE uses the host C++ startup. #165 continues to cover mapped process startup and TLS.
upstream-sync closed this pull request 2026-11-24 06:41:54 +00:00
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!225
No description provided.