diff options
author | Aditya Mandaleeka <adityam@microsoft.com> | 2016-07-28 16:19:06 -0700 |
---|---|---|
committer | Aditya Mandaleeka <adityam@microsoft.com> | 2016-07-28 16:19:06 -0700 |
commit | 002149cadd71aee97a6d0e25c1d9e6edfe21e087 (patch) | |
tree | 900709e760d7fb1c0d20a2fddf6c23366f4698f4 | |
parent | 1c7531b638a6b35befc5fe66e33e2de83ecc6fe1 (diff) | |
download | coreclr-002149cadd71aee97a6d0e25c1d9e6edfe21e087.tar.gz coreclr-002149cadd71aee97a6d0e25c1d9e6edfe21e087.tar.bz2 coreclr-002149cadd71aee97a6d0e25c1d9e6edfe21e087.zip |
Also clear CONTEXT_XSTATE if fpregs aren't available.
-rw-r--r-- | src/pal/src/thread/context.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/pal/src/thread/context.cpp b/src/pal/src/thread/context.cpp index 49d39d2a3d..9aaf105d74 100644 --- a/src/pal/src/thread/context.cpp +++ b/src/pal/src/thread/context.cpp @@ -522,16 +522,19 @@ void CONTEXTFromNativeContext(const native_context_t *native, LPCONTEXT lpContex if (native->uc_mcontext.__fpregs == nullptr) #endif { - // Reset the CONTEXT_FLOATING_POINT bit(s) so it's clear that the floating point - // data in the CONTEXT is not valid. Since CONTEXT_FLOATING_POINT is defined as - // the architecture bit(s) OR'd with one or more other bits, we first get the bits - // that are unique to CONTEXT_FLOATING_POINT by resetting the architecture bits. - // We determine what those are by inverting the union of CONTEXT_CONTROL and - // CONTEXT_INTEGER, both of which should also have the architecture bit(s) set. + // Reset the CONTEXT_FLOATING_POINT bit(s) and the CONTEXT_XSTATE bit(s) so it's + // clear that the floating point and extended state data in the CONTEXT is not + // valid. Since these flags are defined as the architecture bit(s) OR'd with one + // or more other bits, we first get the bits that are unique to each by resetting + // the architecture bits. We determine what those are by inverting the union of + // CONTEXT_CONTROL and CONTEXT_INTEGER, both of which should also have the + // architecture bit(s) set. const ULONG floatingPointFlags = CONTEXT_FLOATING_POINT & ~(CONTEXT_CONTROL & CONTEXT_INTEGER); - lpContext->ContextFlags &= ~floatingPointFlags; + const ULONG xstateFlags = CONTEXT_XSTATE & ~(CONTEXT_CONTROL & CONTEXT_INTEGER); - // Bail out regardless of whether the caller wanted CONTEXT_FLOATING_POINT + lpContext->ContextFlags &= ~(floatingPointFlags | xstateFlags); + + // Bail out regardless of whether the caller wanted CONTEXT_FLOATING_POINT or CONTEXT_XSTATE return; } #endif |