Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
fa47ea74
Commit
fa47ea74
authored
Mar 08, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Determine the native thread context flags on the client side.
parent
eccf9299
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
9 deletions
+31
-9
thread.c
dlls/ntdll/unix/thread.c
+15
-0
server_protocol.h
include/wine/server_protocol.h
+5
-2
protocol.def
server/protocol.def
+2
-0
request.h
server/request.h
+4
-2
thread.c
server/thread.c
+3
-5
trace.c
server/trace.c
+2
-0
No files found.
dlls/ntdll/unix/thread.c
View file @
fa47ea74
...
...
@@ -208,6 +208,18 @@ static unsigned int get_server_context_flags( const void *context, USHORT machin
/***********************************************************************
* get_native_context_flags
*
* Get flags for registers that are set from the native context in WoW mode.
*/
static
unsigned
int
get_native_context_flags
(
USHORT
native_machine
,
USHORT
wow_machine
)
{
if
(
native_machine
==
wow_machine
)
return
0
;
return
SERVER_CTX_DEBUG_REGISTERS
|
SERVER_CTX_FLOATING_POINT
|
SERVER_CTX_YMM_REGISTERS
;
}
/***********************************************************************
* context_to_server
*
* Convert a register context to the server format.
...
...
@@ -1691,6 +1703,7 @@ NTSTATUS set_thread_context( HANDLE handle, const void *context, BOOL *self, USH
SERVER_START_REQ
(
set_thread_context
)
{
req
->
handle
=
wine_server_obj_handle
(
handle
);
req
->
native_flags
=
server_contexts
[
0
].
flags
&
get_native_context_flags
(
native_machine
,
machine
);
wine_server_add_data
(
req
,
server_contexts
,
count
*
sizeof
(
server_contexts
[
0
])
);
ret
=
wine_server_call
(
req
);
*
self
=
reply
->
self
;
...
...
@@ -1717,6 +1730,7 @@ NTSTATUS get_thread_context( HANDLE handle, void *context, BOOL *self, USHORT ma
req
->
handle
=
wine_server_obj_handle
(
handle
);
req
->
flags
=
flags
;
req
->
machine
=
machine
;
req
->
native_flags
=
flags
&
get_native_context_flags
(
native_machine
,
machine
);
wine_server_set_reply
(
req
,
server_contexts
,
sizeof
(
server_contexts
)
);
ret
=
wine_server_call
(
req
);
*
self
=
reply
->
self
;
...
...
@@ -1734,6 +1748,7 @@ NTSTATUS get_thread_context( HANDLE handle, void *context, BOOL *self, USHORT ma
req
->
context
=
wine_server_obj_handle
(
context_handle
);
req
->
flags
=
flags
;
req
->
machine
=
machine
;
req
->
native_flags
=
flags
&
get_native_context_flags
(
native_machine
,
machine
);
wine_server_set_reply
(
req
,
server_contexts
,
sizeof
(
server_contexts
)
);
ret
=
wine_server_call
(
req
);
count
=
wine_server_reply_size
(
reply
)
/
sizeof
(
server_contexts
[
0
]);
...
...
include/wine/server_protocol.h
View file @
fa47ea74
...
...
@@ -2531,8 +2531,9 @@ struct get_thread_context_request
obj_handle_t
handle
;
obj_handle_t
context
;
unsigned
int
flags
;
unsigned
int
native_flags
;
unsigned
short
machine
;
char
__pad_
26
[
6
];
char
__pad_
30
[
2
];
};
struct
get_thread_context_reply
{
...
...
@@ -2548,7 +2549,9 @@ struct set_thread_context_request
{
struct
request_header
__header
;
obj_handle_t
handle
;
unsigned
int
native_flags
;
/* VARARG(contexts,contexts); */
char
__pad_20
[
4
];
};
struct
set_thread_context_reply
{
...
...
@@ -6355,7 +6358,7 @@ union generic_reply
/* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 76
1
#define SERVER_PROTOCOL_VERSION 76
2
/* ### protocol_version end ### */
...
...
server/protocol.def
View file @
fa47ea74
...
...
@@ -1931,6 +1931,7 @@ struct process_info
obj_handle_t handle; /* thread handle */
obj_handle_t context; /* context handle */
unsigned int flags; /* context flags */
unsigned int native_flags; /* flags for native context if WoW present */
unsigned short machine; /* context architecture */
@REPLY
int self; /* was it a handle to the current thread? */
...
...
@@ -1942,6 +1943,7 @@ struct process_info
/* Set the current context of a thread */
@REQ(set_thread_context)
obj_handle_t handle; /* thread handle */
unsigned int native_flags; /* flags for native context if WoW present */
VARARG(contexts,contexts); /* thread context(s) */
@REPLY
int self; /* was it a handle to the current thread? */
...
...
server/request.h
View file @
fa47ea74
...
...
@@ -1278,13 +1278,15 @@ C_ASSERT( sizeof(struct get_timer_info_reply) == 24 );
C_ASSERT
(
FIELD_OFFSET
(
struct
get_thread_context_request
,
handle
)
==
12
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_thread_context_request
,
context
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_thread_context_request
,
flags
)
==
20
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_thread_context_request
,
machine
)
==
24
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_thread_context_request
,
native_flags
)
==
24
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_thread_context_request
,
machine
)
==
28
);
C_ASSERT
(
sizeof
(
struct
get_thread_context_request
)
==
32
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_thread_context_reply
,
self
)
==
8
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_thread_context_reply
,
handle
)
==
12
);
C_ASSERT
(
sizeof
(
struct
get_thread_context_reply
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
set_thread_context_request
,
handle
)
==
12
);
C_ASSERT
(
sizeof
(
struct
set_thread_context_request
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
set_thread_context_request
,
native_flags
)
==
16
);
C_ASSERT
(
sizeof
(
struct
set_thread_context_request
)
==
24
);
C_ASSERT
(
FIELD_OFFSET
(
struct
set_thread_context_reply
,
self
)
==
8
);
C_ASSERT
(
sizeof
(
struct
set_thread_context_reply
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_selector_entry_request
,
handle
)
==
12
);
...
...
server/thread.c
View file @
fa47ea74
...
...
@@ -127,8 +127,6 @@ struct context
/* flags for registers that always need to be set from the server side */
static
const
unsigned
int
system_flags
=
SERVER_CTX_DEBUG_REGISTERS
;
/* flags for registers that are set from the native context even in WoW mode */
static
const
unsigned
int
always_native_flags
=
SERVER_CTX_DEBUG_REGISTERS
|
SERVER_CTX_FLOATING_POINT
|
SERVER_CTX_YMM_REGISTERS
;
static
void
dump_context
(
struct
object
*
obj
,
int
verbose
);
static
int
context_signaled
(
struct
object
*
obj
,
struct
wait_queue_entry
*
entry
);
...
...
@@ -1866,8 +1864,8 @@ DECL_HANDLER(get_thread_context)
if
(
req
->
machine
==
thread_context
->
regs
[
CTX_WOW
].
machine
)
{
native_flags
=
req
->
flags
&
always_
native_flags
;
wow_flags
=
req
->
flags
&
~
always_
native_flags
;
native_flags
=
req
->
native_flags
;
wow_flags
=
req
->
flags
&
~
native_flags
;
}
if
((
context
=
set_reply_data_size
(
(
!!
native_flags
+
!!
wow_flags
)
*
sizeof
(
context_t
)
)))
{
...
...
@@ -1922,7 +1920,7 @@ DECL_HANDLER(set_thread_context)
unsigned
int
ctx
=
CTX_NATIVE
;
const
context_t
*
context
=
&
contexts
[
CTX_NATIVE
];
unsigned
int
flags
=
system_flags
&
context
->
flags
;
unsigned
int
native_flags
=
always_native_flags
&
context
->
flags
;
unsigned
int
native_flags
=
context
->
flags
&
req
->
native_
flags
;
if
(
thread
!=
current
)
stop_thread
(
thread
);
else
if
(
flags
)
set_thread_context
(
thread
,
context
,
flags
);
...
...
server/trace.c
View file @
fa47ea74
...
...
@@ -2509,6 +2509,7 @@ static void dump_get_thread_context_request( const struct get_thread_context_req
fprintf
(
stderr
,
" handle=%04x"
,
req
->
handle
);
fprintf
(
stderr
,
", context=%04x"
,
req
->
context
);
fprintf
(
stderr
,
", flags=%08x"
,
req
->
flags
);
fprintf
(
stderr
,
", native_flags=%08x"
,
req
->
native_flags
);
fprintf
(
stderr
,
", machine=%04x"
,
req
->
machine
);
}
...
...
@@ -2522,6 +2523,7 @@ static void dump_get_thread_context_reply( const struct get_thread_context_reply
static
void
dump_set_thread_context_request
(
const
struct
set_thread_context_request
*
req
)
{
fprintf
(
stderr
,
" handle=%04x"
,
req
->
handle
);
fprintf
(
stderr
,
", native_flags=%08x"
,
req
->
native_flags
);
dump_varargs_contexts
(
", contexts="
,
cur_size
);
}
...
...
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