Skip to content

Commit c6156f4

Browse files
committed
Use CopyContext to restore saved context on X86
1 parent e23382c commit c6156f4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/coreclr/vm/threadsuspend.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2577,7 +2577,13 @@ int RedirectedHandledJITCaseExceptionFilter(
25772577
pFrame->Pop();
25782578

25792579
// Copy the saved context record into the EH context;
2580-
ReplaceExceptionContextRecord(pExcepPtrs->ContextRecord, pCtx);
2580+
// NB: cannot use ReplaceExceptionContextRecord here.
2581+
// these contexts may contain extended registers and may have different format
2582+
// for reasons such as alignment or context compaction
2583+
//
2584+
// REVIEW: CopyContext may fail. in theory. How should we handle that? FailFast?
2585+
CONTEXT* pTarget = pExcepPtrs->ContextRecord;
2586+
CopyContext(pTarget, pTarget->ContextFlags, pCtx);
25812587

25822588
DWORD espValue = pCtx->Esp;
25832589

0 commit comments

Comments
 (0)