Commit 0fde203c authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

ntdll: Don't set xstate in context if xstate features are not supported.

Fixes a regression reproducible on CPUs without XSAVE support introduced by 419abd49. The regression commit erroneously assumes that if XSAVE is not supported then the host signal context won't have xsave data set up. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50271Signed-off-by: 's avatarPaul Gofman <pgofman@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 1647524b
......@@ -774,7 +774,7 @@ static inline void restore_xstate( const CONTEXT *context )
XSAVE_FORMAT *xrstor_base;
XSTATE *xs;
if (!(xs = xstate_from_context( context )))
if (!(user_shared_data->XState.EnabledFeatures && (xs = xstate_from_context( context ))))
return;
xrstor_base = (XSAVE_FORMAT *)xs - 1;
......@@ -891,7 +891,7 @@ static inline void save_context( struct xcontext *xcontext, const ucontext_t *si
context->ContextFlags |= CONTEXT_FLOATING_POINT | CONTEXT_EXTENDED_REGISTERS;
memcpy( context->ExtendedRegisters, fpux, sizeof(*fpux) );
if (!fpu) fpux_to_fpu( &context->FloatSave, fpux );
if ((xs = XState_sig(fpux)))
if (user_shared_data->XState.EnabledFeatures && (xs = XState_sig(fpux)))
{
context_init_xstate( context, xs );
xcontext->host_compaction_mask = xs->CompactionMask;
......
......@@ -1466,7 +1466,7 @@ static void save_context( struct xcontext *xcontext, const ucontext_t *sigcontex
context->ContextFlags |= CONTEXT_FLOATING_POINT;
context->u.FltSave = *FPU_sig(sigcontext);
context->MxCsr = context->u.FltSave.MxCsr;
if ((xs = XState_sig(FPU_sig(sigcontext))))
if (user_shared_data->XState.EnabledFeatures && (xs = XState_sig(FPU_sig(sigcontext))))
{
/* xcontext and sigcontext are both on the signal stack, so we can
* just reference sigcontext without overflowing 32 bit XState.Offset */
......@@ -1546,7 +1546,7 @@ static void restore_context( const struct xcontext *xcontext, ucontext_t *sigcon
amd64_thread_data()->dr7 = context->Dr7;
set_sigcontext( context, sigcontext );
if (FPU_sig(sigcontext)) *FPU_sig(sigcontext) = context->u.FltSave;
if ((xs = XState_sig(FPU_sig(sigcontext))))
if (user_shared_data->XState.EnabledFeatures && (xs = XState_sig(FPU_sig(sigcontext))))
xs->CompactionMask = xcontext->host_compaction_mask;
}
......@@ -1603,7 +1603,7 @@ static void restore_xstate( const CONTEXT *context )
XSAVE_FORMAT *xrstor_base;
XSTATE *xs;
if (!(xs = xstate_from_context( context )))
if (!(user_shared_data->XState.EnabledFeatures && (xs = xstate_from_context( context ))))
return;
xrstor_base = (XSAVE_FORMAT *)xs - 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment