Alexandre Julliard : ntdll: Set the initial process context on x86_64.

Alexandre Julliard julliard at winehq.org
Tue Sep 19 15:47:04 CDT 2017


Module: wine
Branch: master
Commit: e6f68708c505e93c18e33c0d008a0cc63b379732
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e6f68708c505e93c18e33c0d008a0cc63b379732

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Sep 19 12:14:58 2017 +0200

ntdll: Set the initial process context on x86_64.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/signal_x86_64.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
index 6e95257..691ee1f 100644
--- a/dlls/ntdll/signal_x86_64.c
+++ b/dlls/ntdll/signal_x86_64.c
@@ -3057,6 +3057,16 @@ static void *mac_thread_gsbase(void)
 }
 #endif
 
+
+/***********************************************************************
+ *           start_process
+ */
+static void CDECL start_process( LPTHREAD_START_ROUTINE entry, PEB *peb )
+{
+    call_thread_entry_point( kernel32_start_process, entry );
+}
+
+
 /**********************************************************************
  *		signal_init_thread
  */
@@ -3132,7 +3142,15 @@ void signal_init_process( CONTEXT *context, LPTHREAD_START_ROUTINE entry )
     if (sigaction( SIGTRAP, &sig_act, NULL ) == -1) goto error;
 #endif
 
-    /* FIXME: set the initial context */
+    /* build the initial context */
+    context->ContextFlags = CONTEXT_FULL;
+    __asm__( "movw %%cs,%0" : "=m" (context->SegCs) );
+    __asm__( "movw %%ss,%0" : "=m" (context->SegSs) );
+    __asm__( "fxsave %0" : "=m" (context->u.FltSave) );
+    context->Rcx   = (ULONG_PTR)entry;
+    context->Rdx   = (ULONG_PTR)NtCurrentTeb()->Peb;
+    context->Rsp   = (ULONG_PTR)NtCurrentTeb()->Tib.StackBase - 0x28;
+    context->Rip   = (ULONG_PTR)start_process;
     return;
 
  error:




More information about the wine-cvs mailing list