Commit 16ed88a9 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

ntdll: Support AVX context in fault exceptions on Linux x86_64.

parent 3f562e0b
......@@ -428,6 +428,8 @@ static NTSTATUS call_stack_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_contex
NTSTATUS status;
context = *orig_context;
context.ContextFlags &= ~0x40; /* Clear xstate flag. */
dispatch.TargetIp = 0;
dispatch.ContextRecord = &context;
dispatch.HistoryTable = &table;
......
......@@ -5444,7 +5444,8 @@ static DWORD test_extended_context_handler(EXCEPTION_RECORD *rec, EXCEPTION_REGI
/* Since we got xstates enabled by OS this cpuid level should be supported. */
__cpuidex(regs, 0xd, 1);
compaction = regs[0] & 2;
todo_wine ok((context->ContextFlags & (CONTEXT_FULL | CONTEXT_XSTATE)) == (CONTEXT_FULL | CONTEXT_XSTATE),
todo_wine_if(sizeof(void *) == 4)
ok((context->ContextFlags & (CONTEXT_FULL | CONTEXT_XSTATE)) == (CONTEXT_FULL | CONTEXT_XSTATE),
"Got unexpected ContextFlags %#x.\n", context->ContextFlags);
if ((context->ContextFlags & (CONTEXT_FULL | CONTEXT_XSTATE)) != (CONTEXT_FULL | CONTEXT_XSTATE))
......
......@@ -297,6 +297,44 @@ static inline void *get_signal_stack(void)
static inline TEB64 *NtCurrentTeb64(void) { return (TEB64 *)NtCurrentTeb()->GdiBatchCount; }
#endif
#if defined(__i386__) || defined(__x86_64__)
struct xcontext
{
CONTEXT c;
XSTATE *xstate; /* points to xstate in sigcontext */
};
static inline XSTATE *xstate_from_context( const CONTEXT *context )
{
CONTEXT_EX *xctx = (CONTEXT_EX *)(context + 1);
if ((context->ContextFlags & CONTEXT_XSTATE) != CONTEXT_XSTATE)
return NULL;
return (XSTATE *)((char *)(context + 1) + xctx->XState.Offset);
}
static inline void context_init_xstate( CONTEXT *context, void *xstate_buffer )
{
CONTEXT_EX *xctx;
XSTATE *xs;
xctx = (CONTEXT_EX *)(context + 1);
xctx->Legacy.Length = sizeof(CONTEXT);
xctx->Legacy.Offset = -(LONG)sizeof(CONTEXT);
xctx->XState.Length = sizeof(XSTATE);
xctx->XState.Offset = xstate_buffer ? (((ULONG_PTR)xstate_buffer + 63) & ~63) - (ULONG_PTR)xctx
: (((ULONG_PTR)context + sizeof(CONTEXT) + sizeof(CONTEXT_EX) + 63) & ~63) - (ULONG_PTR)xctx;
xctx->All.Length = sizeof(CONTEXT) + xctx->XState.Offset + xctx->XState.Length;
xctx->All.Offset = -(LONG)sizeof(CONTEXT);
context->ContextFlags |= 0x40;
xs = xstate_from_context(context);
memset( xs, 0, offsetof(XSTATE, YmmContext) );
}
#endif
static inline size_t ntdll_wcslen( const WCHAR *str )
{
const WCHAR *s = str;
......
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