startup: with X2W_HOST_CPU=1 a second thread faulting on a site just rewritten stops the run #2188

Closed
opened 2026-11-25 04:00:22 +00:00 by lukaslw-lab · 0 comments
lukaslw-lab commented 2026-11-25 04:00:22 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-25T04:00:22Z.


AI-assisted (Claude Code). With X2W_HOST_CPU=1, debug_launch.py rewrites a missing instruction on its first fault. When two threads run the same site at about the same time, the second thread's fault arrives after the rewrite. The site already holds the replacement, so rewrite_for_host finds nothing to rewrite. The fault is not handled, and the run stops at a second-chance illegal instruction.

Seen in a startup run (Windows 10, i7-4790K, which has no SSE4a). events.txt, title module and address replaced:

192.061 host-cpu insertq at <title>+<site> rewritten
192.067 exception 0xc000001d illegal instruction at <title>+<site> first-chance params=[]
192.070 exception 0xc000001d illegal instruction at <title>+<site> second-chance params=[]
  • The bytes at the stop are the replacement jmp to the stub, not the original instruction.
  • The same site was rewritten without trouble in another run (one thread).
  • Reproducible with the source-built probe: eight threads reach RDPID sites together on a host without RDPID. 3 of 3 runs stopped at the first site.

Related, but a different mechanism: #1281 (threads entering a hooked function while its byte is stepped over).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6596905447 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2196). Originally posted by [lukaslw-lab](https://github.com/lukaslw-lab) on 2026-11-25T04:00:22Z. --- _AI-assisted (Claude Code)._ With `X2W_HOST_CPU=1`, `debug_launch.py` rewrites a missing instruction on its first fault. When two threads run the same site at about the same time, the second thread's fault arrives after the rewrite. The site already holds the replacement, so `rewrite_for_host` finds nothing to rewrite. The fault is not handled, and the run stops at a second-chance illegal instruction. Seen in a startup run (Windows 10, i7-4790K, which has no SSE4a). `events.txt`, title module and address replaced: ``` 192.061 host-cpu insertq at <title>+<site> rewritten 192.067 exception 0xc000001d illegal instruction at <title>+<site> first-chance params=[] 192.070 exception 0xc000001d illegal instruction at <title>+<site> second-chance params=[] ``` - The bytes at the stop are the replacement `jmp` to the stub, not the original instruction. - The same site was rewritten without trouble in another run (one thread). - Reproducible with the source-built probe: eight threads reach RDPID sites together on a host without RDPID. 3 of 3 runs stopped at the first site. Related, but a different mechanism: #1281 (threads entering a hooked function while its byte is stepped over).
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#2188
No description provided.