Jacek Caban : ntdll: Store segment registers in x86_64 syscall frame.
Alexandre Julliard
julliard at winehq.org
Wed Feb 17 16:23:33 CST 2021
Module: wine
Branch: master
Commit: f72940de8e5709605e517f7fe4ac1605ca519c5e
URL: https://source.winehq.org/git/wine.git/?a=commit;h=f72940de8e5709605e517f7fe4ac1605ca519c5e
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Feb 15 21:58:37 2021 +0100
ntdll: Store segment registers in x86_64 syscall frame.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/unix/signal_x86_64.c | 12 ++++++------
tools/winebuild/import.c | 6 ++++++
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c
index 6477bf8a953..35395283619 100644
--- a/dlls/ntdll/unix/signal_x86_64.c
+++ b/dlls/ntdll/unix/signal_x86_64.c
@@ -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)
diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c
index 12ba189aa0a..863d17c2734 100644
--- a/tools/winebuild/import.c
+++ b/tools/winebuild/import.c
@@ -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" );
More information about the wine-cvs
mailing list