mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-11-01 12:45:56 +00:00
RaiseOn suspended the target and, while it sat in host code, resampled it until a 50 ms limit and then redirected it into the handler there. A handler that waits, as Unity's GC thread-stop handler does, then held whatever host lock the thread had: in Graveyard Keeper 2 a job worker stopped inside shader specialization kept the shader registration lock, another worker blocked on that lock never ran its own stop, and the load froze with 39 of 40 threads acknowledged (about 1 in 15 loads). A target in host code is never redirected now. The raise queues the delivery as an APC (taken when the thread waits alertably), arms a debug register 0 execute breakpoint at the frame's return address into guest code (found with the image's own .pdata and RtlVirtualUnwind, stopping at frames that push a machine frame, guarded against faults), and hands the target to a host deliverer thread that keeps sampling it. The first of the three to reach the thread delivers, through one taken flag per delivery. A target in guest code is still redirected at once; a target inside NtContinue still makes the raise throw after 1 s. guest_raise_leaves_host_code checks that a handler never runs in host code, for a target blocked in WaitForSingleObject and one busy in MultiByteToWideChar, and that each raise of the blocked one returns in under 500 ms. Co-Authored-By: Claude Opus 5.5 <[email protected]>