summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAditya Mandaleeka <adityam@microsoft.com>2016-07-28 16:19:06 -0700
committerAditya Mandaleeka <adityam@microsoft.com>2016-07-28 16:19:06 -0700
commit002149cadd71aee97a6d0e25c1d9e6edfe21e087 (patch)
tree900709e760d7fb1c0d20a2fddf6c23366f4698f4
parent1c7531b638a6b35befc5fe66e33e2de83ecc6fe1 (diff)
downloadcoreclr-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.cpp19
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