Commit ba1e2d5d authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

ntdll: Mind context compaction mask in context_from_server().

parent 631a43c5
......@@ -607,7 +607,6 @@ struct xcontext
{
CONTEXT c;
CONTEXT_EX c_ex;
ULONG64 host_compaction_mask;
};
static inline XSAVE_AREA_HEADER *xstate_from_context( const CONTEXT *context )
......@@ -831,11 +830,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 (xstate_extended_features() && (xs = XState_sig(fpux)))
{
context_init_xstate( context, xs );
xcontext->host_compaction_mask = xs->CompactionMask;
}
if (xstate_extended_features() && (xs = XState_sig(fpux))) context_init_xstate( context, xs );
}
if (!fpu && !fpux) save_fpu( context );
}
......@@ -876,15 +871,7 @@ static inline void restore_context( const struct xcontext *xcontext, ucontext_t
SS_sig(sigcontext) = context->SegSs;
if (fpu) *fpu = context->FloatSave;
if (fpux)
{
XSAVE_AREA_HEADER *xs;
memcpy( fpux, context->ExtendedRegisters, sizeof(*fpux) );
if (xstate_extended_features() && (xs = XState_sig(fpux)))
xs->CompactionMask = xcontext->host_compaction_mask;
}
if (fpux) memcpy( fpux, context->ExtendedRegisters, sizeof(*fpux) );
if (!fpu && !fpux) restore_fpu( context );
}
......
......@@ -479,7 +479,6 @@ struct xcontext
{
CONTEXT c;
CONTEXT_EX c_ex;
ULONG64 host_compaction_mask;
};
static inline XSAVE_AREA_HEADER *xstate_from_context( const CONTEXT *context )
......@@ -907,7 +906,6 @@ static void save_context( struct xcontext *xcontext, const ucontext_t *sigcontex
* just reference sigcontext without overflowing 32 bit XState.Offset */
context_init_xstate( context, xs );
assert( xcontext->c_ex.XState.Offset == (BYTE *)xs - (BYTE *)&xcontext->c_ex );
xcontext->host_compaction_mask = xs->CompactionMask;
}
}
}
......@@ -921,7 +919,6 @@ static void save_context( struct xcontext *xcontext, const ucontext_t *sigcontex
static void restore_context( const struct xcontext *xcontext, ucontext_t *sigcontext )
{
const CONTEXT *context = &xcontext->c;
XSAVE_AREA_HEADER *xs;
amd64_thread_data()->dr0 = context->Dr0;
amd64_thread_data()->dr1 = context->Dr1;
......@@ -931,8 +928,6 @@ 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->FltSave;
if (xstate_extended_features() && (xs = XState_sig(FPU_sig(sigcontext))))
xs->CompactionMask = xcontext->host_compaction_mask;
leave_handler( sigcontext );
}
......
......@@ -691,7 +691,7 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma
XSTATE *xs = (XSTATE *)((char *)xctx + xctx->XState.Offset);
xs->Mask &= ~4;
if (user_shared_data->XState.CompactionEnabled) xs->CompactionMask = 0x8000000000000004;
if (xs->CompactionMask) xs->CompactionMask = 0x8000000000000004;
for (i = 0; i < ARRAY_SIZE( from->ymm.regs.ymm_high); i++)
{
if (!from->ymm.regs.ymm_high[i].low && !from->ymm.regs.ymm_high[i].high) continue;
......@@ -765,7 +765,7 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma
XSTATE *xs = (XSTATE *)((char *)xctx + xctx->XState.Offset);
xs->Mask &= ~4;
if (user_shared_data->XState.CompactionEnabled) xs->CompactionMask = 0x8000000000000004;
if (xs->CompactionMask) xs->CompactionMask = 0x8000000000000004;
for (i = 0; i < ARRAY_SIZE( from->ymm.regs.ymm_high); i++)
{
if (!from->ymm.regs.ymm_high[i].low && !from->ymm.regs.ymm_high[i].high) continue;
......@@ -840,7 +840,7 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma
XSTATE *xs = (XSTATE *)((char *)xctx + xctx->XState.Offset);
xs->Mask &= ~4;
if (user_shared_data->XState.CompactionEnabled) xs->CompactionMask = 0x8000000000000004;
if (xs->CompactionMask) xs->CompactionMask = 0x8000000000000004;
for (i = 0; i < ARRAY_SIZE( from->ymm.regs.ymm_high); i++)
{
if (!from->ymm.regs.ymm_high[i].low && !from->ymm.regs.ymm_high[i].high) continue;
......@@ -922,7 +922,7 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma
XSTATE *xs = (XSTATE *)((char *)xctx + xctx->XState.Offset);
xs->Mask &= ~4;
if (user_shared_data->XState.CompactionEnabled) xs->CompactionMask = 0x8000000000000004;
if (xs->CompactionMask) xs->CompactionMask = 0x8000000000000004;
for (i = 0; i < ARRAY_SIZE( from->ymm.regs.ymm_high); i++)
{
if (!from->ymm.regs.ymm_high[i].low && !from->ymm.regs.ymm_high[i].high) continue;
......
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