ntdll: Store segment registers in x86_64 syscall frame.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-02-15 21:58:37 +01:00 committed by Alexandre Julliard
parent 4e5b61bb06
commit f72940de8e
2 changed files with 12 additions and 6 deletions

View File

@ -1945,16 +1945,16 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context )
context->Rbp = frame->rbp;
context->Rip = frame->rip;
context->EFlags = frame->eflags;
__asm__( "movw %%cs,%0" : "=g" (context->SegCs) );
__asm__( "movw %%ss,%0" : "=g" (context->SegSs) );
context->SegCs = frame->cs;
context->SegSs = frame->ss;
context->ContextFlags |= CONTEXT_CONTROL;
}
if (needed_flags & CONTEXT_SEGMENTS)
{
__asm__( "movw %%ds,%0" : "=g" (context->SegDs) );
__asm__( "movw %%es,%0" : "=g" (context->SegEs) );
__asm__( "movw %%fs,%0" : "=g" (context->SegFs) );
__asm__( "movw %%gs,%0" : "=g" (context->SegGs) );
context->SegDs = frame->ds;
context->SegEs = frame->es;
context->SegFs = frame->fs;
context->SegGs = frame->gs;
context->ContextFlags |= CONTEXT_SEGMENTS;
}
if (needed_flags & CONTEXT_FLOATING_POINT)

View File

@ -1529,6 +1529,12 @@ void output_syscalls( DLLSPEC *spec )
output( "\tmovq %%rbx,-0x28(%%rbp)\n" );
output( "\tleaq 0x10(%%rbp),%%rbx\n" );
output( "\tmovq %%rbx,-0x10(%%rbp)\n" );
output( "\tmovw %%cs,-0x20(%%rbp)\n" );
output( "\tmovw %%ds,-0x1e(%%rbp)\n" );
output( "\tmovw %%es,-0x1c(%%rbp)\n" );
output( "\tmovw %%fs,-0x1a(%%rbp)\n" );
output( "\tmovw %%ss,-0x8(%%rbp)\n" );
output( "\tmovw %%gs,-0x6(%%rbp)\n" );
output( "\tfxsave64 (%%rsp)\n" );
output( "\tmovq %%gs:0x30,%%rcx\n" );
output( "\tleaq -0x98(%%rbp),%%rbx\n" );