Bind two ordinary PE import slots in one jump-table translation #761

Closed
opened 2026-11-23 01:55:38 +00:00 by R0Y00 · 2 comments
R0Y00 commented 2026-11-23 01:55:38 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T01:55:38Z.


Why this advances the port

The switch translator can lift ordinary calls and tail jumps through an explicitly bound ordinary IAT slot (#572 and #655). A translation run accepts one slot. A program that needs two host providers on the same reachable path still stops at that boundary. This task extends a documented startup and ABI building block within #317.

Scope

Extend the existing binding interface to describe two distinct ordinary IAT slots, each with its own provider, name or ordinal, argument count and guaranteed return width. Keep the existing single-binding invocation working. Resolve each reachable call or tail jump against its actual slot and preserve the existing ABI and frame checks. Use source-built DLLs and a switch function with two distinguishable paths. One provider is an ordinary call and the other is reachable as a tail jump. Reuse the existing fixtures and host wrappers where possible.

Acceptance

  • Native and AOT executions match the argument trace, published result and returned bytes on both paths. Use deliberately distinguishable provider results and exercise each declared return width.
  • A call to a second slot with only the first binding, a conflicting binding for the same slot, and a provider or symbol mismatch are all rejected. The existing single-binding positive and malformed-binding controls still pass.
  • Register a focused Windows CTest and show the exact commands and results in both dev and release. Record any first diagnostic. Delay imports and dynamically selected targets stay outside this fixture.

To claim, comment with the binding interface and fixture you intend to extend. Refs #317, #572 and #655.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6550677534 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/767). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T01:55:38Z. --- ## Why this advances the port The switch translator can lift ordinary calls and tail jumps through an explicitly bound ordinary IAT slot (#572 and #655). A translation run accepts one slot. A program that needs two host providers on the same reachable path still stops at that boundary. This task extends a documented startup and ABI building block within #317. ## Scope Extend the existing binding interface to describe two distinct ordinary IAT slots, each with its own provider, name or ordinal, argument count and guaranteed return width. Keep the existing single-binding invocation working. Resolve each reachable call or tail jump against its actual slot and preserve the existing ABI and frame checks. Use source-built DLLs and a switch function with two distinguishable paths. One provider is an ordinary call and the other is reachable as a tail jump. Reuse the existing fixtures and host wrappers where possible. ## Acceptance - Native and AOT executions match the argument trace, published result and returned bytes on both paths. Use deliberately distinguishable provider results and exercise each declared return width. - A call to a second slot with only the first binding, a conflicting binding for the same slot, and a provider or symbol mismatch are all rejected. The existing single-binding positive and malformed-binding controls still pass. - Register a focused Windows CTest and show the exact commands and results in both `dev` and `release`. Record any first diagnostic. Delay imports and dynamically selected targets stay outside this fixture. To claim, comment with the binding interface and fixture you intend to extend. Refs #317, #572 and #655.
lukaslw-lab commented 2026-11-24 06:48:56 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-23T02:07:02Z.


I'd like to take this.

Interface: make --bind PROVIDER SYMBOL in tools/cpu_switch_aot.py repeatable. With two bindings, the --link-name, --import-arguments and --return-bytes after each --bind belong to it. A single --bind parses exactly as today. Each reached IAT slot is matched to the binding whose import it holds, through resolve_import. A slot matching no binding or two bindings is rejected, and so is a binding that no call or tail jump uses. cpu_translation() gets an optional second binding. If you'd rather have a binding manifest like --bind-ranges, I can do that instead.

Fixture: a new source-built switch fixture next to import_calls, so the existing layout checks stay untouched. One path calls cpu_tail_named_provider!mix3 (3 args, 8 bytes) and the other tail-jumps to a second provider with a different return width. It is compared native against AOT on the argument trace, published result and returned bytes, plus the three rejection controls from the issue. The #655 controls are kept.

Environment: Windows 10 Pro 22H2 (19045), VS 2026 / MSVC 19.52, dev and release. Delay imports and dynamic targets are out of scope.

Refs #317, #572, #655.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7089676222 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/767#issuecomment-7089676222). Originally posted by [lukaslw-lab](https://github.com/lukaslw-lab) on 2026-11-23T02:07:02Z. --- I'd like to take this. **Interface:** make `--bind PROVIDER SYMBOL` in `tools/cpu_switch_aot.py` repeatable. With two bindings, the `--link-name`, `--import-arguments` and `--return-bytes` after each `--bind` belong to it. A single `--bind` parses exactly as today. Each reached IAT slot is matched to the binding whose import it holds, through `resolve_import`. A slot matching no binding or two bindings is rejected, and so is a binding that no call or tail jump uses. `cpu_translation()` gets an optional second binding. If you'd rather have a binding manifest like `--bind-ranges`, I can do that instead. **Fixture:** a new source-built switch fixture next to `import_calls`, so the existing layout checks stay untouched. One path calls `cpu_tail_named_provider!mix3` (3 args, 8 bytes) and the other tail-jumps to a second provider with a different return width. It is compared native against AOT on the argument trace, published result and returned bytes, plus the three rejection controls from the issue. The #655 controls are kept. **Environment:** Windows 10 Pro 22H2 (19045), VS 2026 / MSVC 19.52, `dev` and `release`. Delay imports and dynamic targets are out of scope. Refs #317, #572, #655.
R0Y00 commented 2026-11-24 06:48:57 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T02:20:26Z.


Please go ahead with repeatable --bind PROVIDER SYMBOL. Keep the existing single-binding command unchanged. When two bindings select different IAT slots, verify each uses its own argument count and return-width contract, including the tail jump. Please keep the three rejection controls and add an argument-order check if the per-binding flags could otherwise be silently applied to the wrong binding.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7089859311 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/767#issuecomment-7089859311). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T02:20:26Z. --- Please go ahead with repeatable `--bind PROVIDER SYMBOL`. Keep the existing single-binding command unchanged. When two bindings select different IAT slots, verify each uses its own argument count and return-width contract, including the tail jump. Please keep the three rejection controls and add an argument-order check if the per-binding flags could otherwise be silently applied to the wrong binding.
Sign in to join this conversation.
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#761
No description provided.