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

Closed
opened 2026-11-26 22:16:59 +00:00 by github-bot · 2 comments
Owner

@⁠R0Y00 on GitHub · 2026-11-23 01:55 UTC · original

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.

**@⁠R0Y00** on GitHub · 2026-11-23 01:55 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/767) ## 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.
github-bot 2026-11-26 22:16:59 +00:00
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:16:59 +00:00
Author
Owner

@⁠lukaslw-lab on GitHub · 2026-11-23 02:07 UTC · original

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.

**@⁠lukaslw-lab** on GitHub · 2026-11-23 02:07 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/767#issuecomment-7089676222) 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.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-23 02:20 UTC · original

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.

**@⁠R0Y00** on GitHub · 2026-11-23 02:20 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/767#issuecomment-7089859311) 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.
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/R0Y00--Xbox2Windows#767
No description provided.