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

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2018-01-22 13:11:56 +01:00
parent a6f85e616d
commit 03d31ea81d
3 changed files with 12 additions and 3 deletions

View File

@ -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;
}

View File

@ -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 */

View File

@ -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 );
}