Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
8eda3fcc
Commit
8eda3fcc
authored
May 18, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Pass a server context to server_select().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f04c2bd4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
45 deletions
+15
-45
server.c
dlls/ntdll/unix/server.c
+4
-23
thread.c
dlls/ntdll/unix/thread.c
+10
-19
unix_private.h
dlls/ntdll/unix/unix_private.h
+1
-3
No files found.
dlls/ntdll/unix/server.c
View file @
8eda3fcc
...
...
@@ -620,24 +620,18 @@ static void invoke_system_apc( const apc_call_t *call, apc_result_t *result, BOO
* server_select
*/
unsigned
int
server_select
(
const
select_op_t
*
select_op
,
data_size_t
size
,
UINT
flags
,
timeout_t
abs_timeout
,
CONTEXT
*
context
,
pthread_mutex_t
*
mutex
,
timeout_t
abs_timeout
,
context_t
*
context
,
pthread_mutex_t
*
mutex
,
user_apc_t
*
user_apc
)
{
unsigned
int
ret
;
int
cookie
;
obj_handle_t
apc_handle
=
0
;
context_t
server_context
;
BOOL
suspend_context
=
FALSE
;
BOOL
suspend_context
=
!!
context
;
apc_call_t
call
;
apc_result_t
result
;
sigset_t
old_set
;
memset
(
&
result
,
0
,
sizeof
(
result
)
);
if
(
context
)
{
suspend_context
=
TRUE
;
context_to_server
(
&
server_context
,
context
,
current_machine
);
}
do
{
...
...
@@ -655,26 +649,13 @@ unsigned int server_select( const select_op_t *select_op, data_size_t size, UINT
wine_server_add_data
(
req
,
select_op
,
size
);
if
(
suspend_context
)
{
wine_server_add_data
(
req
,
&
server_context
,
sizeof
(
server_
context
)
);
wine_server_add_data
(
req
,
context
,
sizeof
(
*
context
)
);
suspend_context
=
FALSE
;
/* server owns the context now */
}
if
(
context
)
wine_server_set_reply
(
req
,
&
server_context
,
sizeof
(
server_
context
)
);
if
(
context
)
wine_server_set_reply
(
req
,
context
,
sizeof
(
*
context
)
);
ret
=
server_call_unlocked
(
req
);
apc_handle
=
reply
->
apc_handle
;
call
=
reply
->
call
;
if
(
wine_server_reply_size
(
reply
))
{
DWORD
context_flags
=
context
->
ContextFlags
;
/* unchanged registers are still available */
XSTATE
*
xs
=
xstate_from_context
(
context
);
ULONG64
mask
;
if
(
xs
)
mask
=
xs
->
Mask
;
context_from_server
(
context
,
&
server_context
,
current_machine
);
context
->
ContextFlags
|=
context_flags
;
if
(
xs
)
xs
->
Mask
|=
mask
;
}
}
SERVER_END_REQ
;
...
...
dlls/ntdll/unix/thread.c
View file @
8eda3fcc
...
...
@@ -139,7 +139,7 @@ static unsigned int get_server_context_flags( const void *context, USHORT machin
*
* Convert a register context to the server format.
*/
NTSTATUS
context_to_server
(
context_t
*
to
,
const
void
*
src
,
USHORT
machine
)
static
NTSTATUS
context_to_server
(
context_t
*
to
,
const
void
*
src
,
USHORT
machine
)
{
DWORD
i
,
flags
;
...
...
@@ -388,7 +388,7 @@ NTSTATUS context_to_server( context_t *to, const void *src, USHORT machine )
*
* Convert a register context from the server format.
*/
NTSTATUS
context_from_server
(
void
*
dst
,
const
context_t
*
from
,
USHORT
machine
)
static
NTSTATUS
context_from_server
(
void
*
dst
,
const
context_t
*
from
,
USHORT
machine
)
{
DWORD
i
;
...
...
@@ -1052,9 +1052,12 @@ void exit_process( int status )
void
wait_suspend
(
CONTEXT
*
context
)
{
int
saved_errno
=
errno
;
context_t
server_context
;
context_to_server
(
&
server_context
,
context
,
current_machine
);
/* wait with 0 timeout, will only return once the thread is no longer suspended */
server_select
(
NULL
,
0
,
SELECT_INTERRUPTIBLE
,
0
,
context
,
NULL
,
NULL
);
server_select
(
NULL
,
0
,
SELECT_INTERRUPTIBLE
,
0
,
&
server_context
,
NULL
,
NULL
);
context_from_server
(
context
,
&
server_context
,
current_machine
);
errno
=
saved_errno
;
}
...
...
@@ -1095,22 +1098,15 @@ NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL first_c
if
(
handle
)
{
struct
xcontext
exception_context
;
DECLSPEC_ALIGN
(
64
)
XSTATE
xs
;
XSTATE
*
src_xs
;
context_t
server_context
;
select_op
.
wait
.
op
=
SELECT_WAIT
;
select_op
.
wait
.
handles
[
0
]
=
handle
;
exception_context
.
c
=
*
context
;
if
((
src_xs
=
xstate_from_context
(
context
)))
{
context_init_xstate
(
&
exception_context
.
c
,
&
xs
);
memcpy
(
&
xs
,
src_xs
,
sizeof
(
xs
)
);
}
context_to_server
(
&
server_context
,
context
,
current_machine
);
server_select
(
&
select_op
,
offsetof
(
select_op_t
,
wait
.
handles
[
1
]
),
SELECT_INTERRUPTIBLE
,
TIMEOUT_INFINITE
,
&
exception_context
.
c
,
NULL
,
NULL
);
TIMEOUT_INFINITE
,
&
server_context
,
NULL
,
NULL
);
SERVER_START_REQ
(
get_exception_status
)
{
...
...
@@ -1118,12 +1114,7 @@ NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL first_c
ret
=
wine_server_call
(
req
);
}
SERVER_END_REQ
;
if
(
ret
>=
0
)
{
*
context
=
exception_context
.
c
;
if
(
src_xs
)
memcpy
(
src_xs
,
&
xs
,
sizeof
(
xs
)
);
}
if
(
ret
>=
0
)
context_from_server
(
context
,
&
server_context
,
current_machine
);
}
pthread_sigmask
(
SIG_SETMASK
,
&
old_set
,
NULL
);
...
...
dlls/ntdll/unix/unix_private.h
View file @
8eda3fcc
...
...
@@ -159,7 +159,7 @@ extern unsigned int server_call_unlocked( void *req_ptr ) DECLSPEC_HIDDEN;
extern
void
server_enter_uninterrupted_section
(
pthread_mutex_t
*
mutex
,
sigset_t
*
sigset
)
DECLSPEC_HIDDEN
;
extern
void
server_leave_uninterrupted_section
(
pthread_mutex_t
*
mutex
,
sigset_t
*
sigset
)
DECLSPEC_HIDDEN
;
extern
unsigned
int
server_select
(
const
select_op_t
*
select_op
,
data_size_t
size
,
UINT
flags
,
timeout_t
abs_timeout
,
CONTEXT
*
context
,
pthread_mutex_t
*
mutex
,
timeout_t
abs_timeout
,
context_t
*
context
,
pthread_mutex_t
*
mutex
,
user_apc_t
*
user_apc
)
DECLSPEC_HIDDEN
;
extern
unsigned
int
server_wait
(
const
select_op_t
*
select_op
,
data_size_t
size
,
UINT
flags
,
const
LARGE_INTEGER
*
timeout
)
DECLSPEC_HIDDEN
;
...
...
@@ -177,8 +177,6 @@ extern int server_pipe( int fd[2] ) DECLSPEC_HIDDEN;
extern
void
set_thread_id
(
TEB
*
teb
,
DWORD
pid
,
DWORD
tid
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
init_thread_stack
(
TEB
*
teb
,
ULONG_PTR
zero_bits
,
SIZE_T
reserve_size
,
SIZE_T
commit_size
,
SIZE_T
*
pthread_size
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
context_to_server
(
context_t
*
to
,
const
void
*
src
,
USHORT
machine
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
context_from_server
(
void
*
dst
,
const
context_t
*
from
,
USHORT
machine
)
DECLSPEC_HIDDEN
;
extern
void
DECLSPEC_NORETURN
abort_thread
(
int
status
)
DECLSPEC_HIDDEN
;
extern
void
DECLSPEC_NORETURN
abort_process
(
int
status
)
DECLSPEC_HIDDEN
;
extern
void
DECLSPEC_NORETURN
exit_process
(
int
status
)
DECLSPEC_HIDDEN
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment