Repository navigation
Conversation
guard::make_call_tracer already appended UNWIND_INFO + RUNTIME_FUNCTION and called RtlAddFunctionTable, but stubs::make_stub_info (sub rsp, 0x28) and guard::thunk (push rcx/rdx/r8/r9; sub rsp, 0x68) did not. Without .pdata, RtlLookupFunctionEntry treats those thunks as leaf functions and breaks eh::unwind / SEH / C++ unwinding whenever a stub hook or guard callback is on the stack. Extract stubs::alloc_code_with_unwind and use it for make_stub_info, make_call_tracer, and guard::thunk (covering the framed span up to the restored leaf state before the tail jump). Add live-stack RtlVirtualUnwind tests for both stub and guard thunks. Assisted-by: Antigravity (Gemini 4 Neon)
Owner
Author
|
Upstream PR xcl-dev#936 was closed or merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Registers x64
.pdata(UNWIND_INFO+RUNTIME_FUNCTIONviaRtlAddFunctionTable) for the RWX thunks emitted bystubs::make_stub_infoandd3d12x::guard::thunk, matching whatguard::make_call_traceralready does.Without
.pdata, WindowsRtlLookupFunctionEntrytreats those thunks as leaf functions even thoughmake_stub_infoadjustsrsp(sub rsp, 0x28) andguard::thunkpushesrcx/rdx/r8/r9and allocates0x68bytes before calling into Rust. That breakseh::unwind(eh::dump_threads) and SEH/C++ unwinding whenever a stub hook or guard callback is on the stack.What is in it
crates/xcl/src/stubs.rs: extractalloc_code_with_unwind(appends 4-byte-alignedUNWIND_INFO+RUNTIME_FUNCTION, flushes icache, callsRtlAddFunctionTable) and use it inmake_stub_info(UWOP_ALLOC_SMALLforsub rsp, 0x28); add live-stackRtlVirtualUnwindtest (stub_thunk_unwinds_through_pdata_to_its_caller).crates/xcl/src/hle/d3d12x/guard.rs: reusestubs::alloc_code_with_unwindinmake_call_tracerand register unwind info forthunk(sub rsp, 0x68+push r9/r8/rdx/rcx, ending right before the tail jump once the stack is restored to leaf state); add live-stackRtlVirtualUnwindtest (guard_thunk_unwinds_through_pdata_to_its_caller).Tested
26300), Intel Core i9-9900K, AMD Radeon RX 6800 (16337 MiB VRAM, driver32.0.21045.29003),rustc 1.100.0(x86_64-pc-windows-msvc), DXC1.9.2602.17(debugfor tests,releasefor smoke runs).XCL_REQUIRE_GPU=wave64,mesh+cargo test --workspace --no-fail-fast -- --test-threads=4on9a1e188: 715 passed, 3 failed, 41 ignored, 0 GPU skipped (xcllib: 674 passed / 3 failed / 21 ignored; integration/e2e: 41 passed / 0 failed / 20 ignored;XCL_SAMPLE_*unset).stubs::tests::stub_thunk_unwinds_through_pdata_to_its_callerandhle::d3d12x::guard::tests::guard_thunk_unwinds_through_pdata_to_its_caller) pass.placed_title_textures_share_vram_and_preserve_pixels(3D 64x64x64 4 mips: subresource 2 mismatch, failing identically on unmodifiedmainand fixed by open PR D3D12.X: map a one-slice title texture's packed mips where D3D12 addresses them xcl-dev/xcl#470) plus its 2VRAM_TEST_LOCKPoisonErrorcascades (transitions_apply_when_their_list_is_submittedandd32s8_targets_take_their_own_size_of_video_memory, which pass when run individually).Regression run
Both runs below used the same warmed shader/PSO cache on
YouKnowWho(60 s):main(09940bb87fa1):PR head (
9a1e18804c89):Not tested
XCL_SAMPLE_*unset).RtlCaptureContext+RtlLookupFunctionEntry+RtlVirtualUnwind).AI use
Mirror of xcl-dev#936 (auto-synced, do not edit).