Fixes a regression reproducible on CPUs without XSAVE support introduced by 419abd49a1f816e5a869dbf4cc81114cd516138b.
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=50271 Signed-off-by: Paul Gofman pgofman@codeweavers.com --- dlls/ntdll/unix/signal_i386.c | 4 ++-- dlls/ntdll/unix/signal_x86_64.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index 2e75d0b84ff..f1fd2cd2e41 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -784,7 +784,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; @@ -901,7 +901,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; diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index 1b5c2e59444..59b7a3750c4 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -1483,7 +1483,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 */ @@ -1563,7 +1563,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; }
@@ -1637,7 +1637,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;