Alexandre Julliard : server: Only update the modified parts of the context on thread suspend.

Alexandre Julliard julliard at winehq.org
Mon Jan 22 15:34:55 CST 2018


Module: wine
Branch: master
Commit: 03d31ea81db4fe4ca3c534dc460115fb3cfeb9af
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=03d31ea81db4fe4ca3c534dc460115fb3cfeb9af

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Jan 22 13:11:56 2018 +0100

server: Only update the modified parts of the context on thread suspend.

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

---

 dlls/ntdll/exception.c         | 7 ++++++-
 include/wine/server_protocol.h | 2 +-
 server/thread.c                | 6 +++++-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/dlls/ntdll/exception.c b/dlls/ntdll/exception.c
index daca45a..f853810 100644
--- a/dlls/ntdll/exception.c
+++ b/dlls/ntdll/exception.c
@@ -110,6 +110,7 @@ void wait_suspend( CONTEXT *context )
     LARGE_INTEGER timeout;
     int saved_errno = errno;
     context_t server_context;
+    DWORD flags = context->ContextFlags;
 
     context_to_server( &server_context, context );
 
@@ -130,10 +131,14 @@ void wait_suspend( CONTEXT *context )
     {
         wine_server_set_reply( req, &server_context, sizeof(server_context) );
         wine_server_call( req );
+        if (wine_server_reply_size( reply ))
+        {
+            context_from_server( context, &server_context );
+            context->ContextFlags |= flags;  /* unchanged registers are still available */
+        }
     }
     SERVER_END_REQ;
 
-    context_from_server( context, &server_context );
     errno = saved_errno;
 }
 
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 0d0d074..ba9f66f 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -6496,6 +6496,6 @@ union generic_reply
     struct terminate_job_reply terminate_job_reply;
 };
 
-#define SERVER_PROTOCOL_VERSION 547
+#define SERVER_PROTOCOL_VERSION 548
 
 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/server/thread.c b/server/thread.c
index 2f65c16..e313dfe 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -1715,7 +1715,10 @@ DECL_HANDLER(get_suspend_context)
 
     if (current->suspend_context)
     {
-        set_reply_data_ptr( current->suspend_context, sizeof(context_t) );
+        if (current->suspend_context->flags)
+            set_reply_data_ptr( current->suspend_context, sizeof(context_t) );
+        else
+            free( current->suspend_context );
         if (current->context == current->suspend_context)
         {
             current->context = NULL;
@@ -1745,6 +1748,7 @@ DECL_HANDLER(set_suspend_context)
     else if ((current->suspend_context = mem_alloc( sizeof(context_t) )))
     {
         memcpy( current->suspend_context, get_req_data(), sizeof(context_t) );
+        current->suspend_context->flags = 0;  /* to keep track of what is modified */
         current->context = current->suspend_context;
         if (current->debug_break) break_thread( current );
     }




More information about the wine-cvs mailing list