Skip to content

Commit

Permalink
[Release/6.0] Backporting recent fixes related to AVX and suspension. (
Browse files Browse the repository at this point in the history
…#66120)

* Use CopyContext to restore saved context on X86 (#65490)

* Use CopyContext to restore saved context on X86

* PR feedback

* more PR feedback

* Do not copy XState other than AVX when redirecting for GC stress (#65825)

* Do not copy XState other than AVX

* #if defined(TARGET_X86) || defined(TARGET_AMD64)

* mask XState unconditionally

* Ensure XSTATE_MASK_AVX is set before calling EEGetThreadContext

* redundant supportsAVX, more clear comment

* PR feedback

* null-check the redirect context before using. (#65910)

* null-check the redirect context before using.

* tweak the comment

* do not allocate context if InitializeContext has unexpected results.

* EE Suspension on x86 should use RtlRestoreContext when available (#65878)

* RestoreContextSimulated

* probe for RtlRestoreContext

* ntdll.dll

* restore self-trap sequence

* PR feedback

* Clarify CopyContext in RedirectedHandledJITCaseExceptionFilter

* simpler indentation.

* restore last error on the legacy path.

* Update src/coreclr/vm/threads.h

Co-authored-by: Dan Moseley <danmose@microsoft.com>

Co-authored-by: Dan Moseley <danmose@microsoft.com>
  • Loading branch information
VSadov and danmoseley committed Mar 8, 2022
1 parent 154cbb0 commit 1ec6f8e
Show file tree
Hide file tree
Showing 2 changed files with 199 additions and 159 deletions.
8 changes: 8 additions & 0 deletions src/coreclr/vm/threads.h
Original file line number Diff line number Diff line change
Expand Up @@ -3292,6 +3292,14 @@ class Thread
static void __stdcall RedirectedHandledJITCaseForGCStress();
#endif // defined(HAVE_GCCOVER) && USE_REDIRECT_FOR_GCSTRESS

#ifdef TARGET_X86
// RtlRestoreContext is available on x86, but relatively recently.
// RestoreContextSimulated uses SEH machinery for a similar result on legacy OS-es.
// This function should not be used on new OS-es as the pattern is not
// guaranteed to continue working in the future.
static void RestoreContextSimulated(Thread* pThread, CONTEXT* pCtx, void* pFrame, DWORD dwLastError);
#endif

friend void CPFH_AdjustContextForThreadSuspensionRace(T_CONTEXT *pContext, Thread *pThread);
#endif // FEATURE_HIJACK && !TARGET_UNIX

Expand Down
Loading

0 comments on commit 1ec6f8e

Please sign in to comment.