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
77f5e296
Commit
77f5e296
authored
Aug 25, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Store the syscall flags in the syscall frame on all platforms.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
079c47a3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
16 deletions
+19
-16
signal_i386.c
dlls/ntdll/unix/signal_i386.c
+7
-5
signal_x86_64.c
dlls/ntdll/unix/signal_x86_64.c
+10
-5
unix_private.h
dlls/ntdll/unix/unix_private.h
+0
-1
import.c
tools/winebuild/import.c
+2
-5
No files found.
dlls/ntdll/unix/signal_i386.c
View file @
77f5e296
...
...
@@ -519,6 +519,8 @@ C_ASSERT( offsetof( TEB, GdiTebBatch ) + offsetof( struct x86_thread_data, sysca
#define SYSCALL_HAVE_XSAVEC 2
#define SYSCALL_HAVE_FXSAVE 4
static
unsigned
int
syscall_flags
;
static
inline
struct
x86_thread_data
*
x86_thread_data
(
void
)
{
return
(
struct
x86_thread_data
*
)
ntdll_get_thread_data
()
->
cpu_data
;
...
...
@@ -1614,7 +1616,7 @@ NTSTATUS WINAPI KeUserModeCallback( ULONG id, const void *args, ULONG len, void
callback_frame
.
frame
.
esp
=
(
ULONG_PTR
)
stack
;
callback_frame
.
frame
.
eip
=
(
ULONG_PTR
)
pKiUserCallbackDispatcher
;
callback_frame
.
frame
.
eflags
=
0x202
;
callback_frame
.
frame
.
syscall_flags
=
__wine_
syscall_flags
;
callback_frame
.
frame
.
syscall_flags
=
frame
->
syscall_flags
;
callback_frame
.
frame
.
prev_frame
=
frame
;
x86_thread_data
()
->
syscall_frame
=
&
callback_frame
.
frame
;
...
...
@@ -2340,9 +2342,9 @@ void signal_init_process(void)
x86_thread_data
()
->
syscall_frame
=
(
struct
syscall_frame
*
)
kernel_stack
-
1
;
if
(
cpu_info
.
ProcessorFeatureBits
&
CPU_FEATURE_FXSR
)
__wine_
syscall_flags
|=
SYSCALL_HAVE_FXSAVE
;
if
(
cpu_info
.
ProcessorFeatureBits
&
CPU_FEATURE_XSAVE
)
__wine_
syscall_flags
|=
SYSCALL_HAVE_XSAVE
;
if
(
xstate_compaction_enabled
)
__wine_
syscall_flags
|=
SYSCALL_HAVE_XSAVEC
;
if
(
cpu_info
.
ProcessorFeatureBits
&
CPU_FEATURE_FXSR
)
syscall_flags
|=
SYSCALL_HAVE_FXSAVE
;
if
(
cpu_info
.
ProcessorFeatureBits
&
CPU_FEATURE_XSAVE
)
syscall_flags
|=
SYSCALL_HAVE_XSAVE
;
if
(
xstate_compaction_enabled
)
syscall_flags
|=
SYSCALL_HAVE_XSAVEC
;
sig_act
.
sa_mask
=
server_block_set
;
sig_act
.
sa_flags
=
SA_SIGINFO
|
SA_RESTART
|
SA_ONSTACK
;
...
...
@@ -2417,7 +2419,7 @@ void DECLSPEC_HIDDEN call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, B
frame
->
esp
=
(
DWORD
)
stack
;
frame
->
eip
=
(
DWORD
)
pLdrInitializeThunk
;
frame
->
prev_frame
=
NULL
;
frame
->
syscall_flags
=
__wine_
syscall_flags
;
frame
->
syscall_flags
=
syscall_flags
;
frame
->
restore_flags
|=
CONTEXT_INTEGER
;
pthread_sigmask
(
SIG_UNBLOCK
,
&
server_block_set
,
NULL
);
...
...
dlls/ntdll/unix/signal_x86_64.c
View file @
77f5e296
...
...
@@ -285,6 +285,8 @@ C_ASSERT( sizeof(struct stack_layout) == 0x590 ); /* Should match the size in ca
#define SYSCALL_HAVE_PTHREAD_TEB 4
#define SYSCALL_HAVE_WRFSGSBASE 8
static
unsigned
int
syscall_flags
;
/* stack layout when calling an user apc function.
* FIXME: match Windows ABI. */
struct
apc_stack_layout
...
...
@@ -325,7 +327,8 @@ struct syscall_frame
DWORD
restore_flags
;
/* 0094 */
ULONG64
rbp
;
/* 0098 */
struct
syscall_frame
*
prev_frame
;
/* 00a0 */
ULONG64
align
[
3
];
/* 00a8 */
DWORD
syscall_flags
;
/* 00a8 */
DWORD
align
[
5
];
/* 00ac */
XMM_SAVE_AREA32
xsave
;
/* 00c0 */
DECLSPEC_ALIGN
(
64
)
XSTATE
xstate
;
/* 02c0 */
};
...
...
@@ -2314,6 +2317,7 @@ NTSTATUS WINAPI KeUserModeCallback( ULONG id, const void *args, ULONG len, void
callback_frame
.
frame
.
eflags
=
0x200
;
callback_frame
.
frame
.
restore_flags
=
CONTEXT_CONTROL
|
CONTEXT_INTEGER
;
callback_frame
.
frame
.
prev_frame
=
frame
;
callback_frame
.
frame
.
syscall_flags
=
frame
->
syscall_flags
;
amd64_thread_data
()
->
syscall_frame
=
&
callback_frame
.
frame
;
__wine_syscall_dispatcher_return
(
&
callback_frame
.
frame
,
0
);
...
...
@@ -2935,8 +2939,8 @@ void signal_init_process(void)
anon_mmap_fixed
(
ptr
,
page_size
,
PROT_READ
|
PROT_WRITE
,
0
);
*
(
void
**
)
ptr
=
__wine_syscall_dispatcher
;
if
(
cpu_info
.
ProcessorFeatureBits
&
CPU_FEATURE_XSAVE
)
__wine_
syscall_flags
|=
SYSCALL_HAVE_XSAVE
;
if
(
xstate_compaction_enabled
)
__wine_
syscall_flags
|=
SYSCALL_HAVE_XSAVEC
;
if
(
cpu_info
.
ProcessorFeatureBits
&
CPU_FEATURE_XSAVE
)
syscall_flags
|=
SYSCALL_HAVE_XSAVE
;
if
(
xstate_compaction_enabled
)
syscall_flags
|=
SYSCALL_HAVE_XSAVEC
;
#ifdef __linux__
if
(
NtCurrentTeb
()
->
WowTebOffset
)
...
...
@@ -2948,8 +2952,8 @@ void signal_init_process(void)
if
((
sel
=
alloc_fs_sel
(
-
1
,
teb32
))
!=
-
1
)
{
fs32_sel
=
(
sel
<<
3
)
|
3
;
__wine_
syscall_flags
|=
SYSCALL_HAVE_PTHREAD_TEB
;
if
(
getauxval
(
AT_HWCAP2
)
&
2
)
__wine_
syscall_flags
|=
SYSCALL_HAVE_WRFSGSBASE
;
syscall_flags
|=
SYSCALL_HAVE_PTHREAD_TEB
;
if
(
getauxval
(
AT_HWCAP2
)
&
2
)
syscall_flags
|=
SYSCALL_HAVE_WRFSGSBASE
;
}
else
ERR_
(
seh
)(
"failed to allocate %%fs selector
\n
"
);
}
...
...
@@ -3038,6 +3042,7 @@ void DECLSPEC_HIDDEN call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, B
frame
->
rcx
=
(
ULONG64
)
ctx
;
frame
->
prev_frame
=
NULL
;
frame
->
restore_flags
|=
CONTEXT_INTEGER
;
frame
->
syscall_flags
=
syscall_flags
;
pthread_sigmask
(
SIG_UNBLOCK
,
&
server_block_set
,
NULL
);
__wine_syscall_dispatcher_return
(
frame
,
0
);
...
...
dlls/ntdll/unix/unix_private.h
View file @
77f5e296
...
...
@@ -252,7 +252,6 @@ extern void DECLSPEC_NORETURN signal_start_thread( PRTL_THREAD_START_ROUTINE ent
extern
void
DECLSPEC_NORETURN
signal_exit_thread
(
int
status
,
void
(
*
func
)(
int
),
TEB
*
teb
)
DECLSPEC_HIDDEN
;
extern
void
__wine_syscall_dispatcher
(
void
)
DECLSPEC_HIDDEN
;
extern
void
WINAPI
DECLSPEC_NORETURN
__wine_syscall_dispatcher_return
(
void
*
frame
,
ULONG_PTR
retval
)
DECLSPEC_HIDDEN
;
extern
unsigned
int
__wine_syscall_flags
DECLSPEC_HIDDEN
;
extern
NTSTATUS
signal_set_full_context
(
CONTEXT
*
context
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
get_thread_wow64_context
(
HANDLE
handle
,
void
*
ctx
,
ULONG
size
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
set_thread_wow64_context
(
HANDLE
handle
,
const
void
*
ctx
,
ULONG
size
)
DECLSPEC_HIDDEN
;
...
...
tools/winebuild/import.c
View file @
77f5e296
...
...
@@ -1576,7 +1576,7 @@ static void output_syscall_dispatcher(void)
/* Legends of Runeterra hooks the first system call return instruction, and
* depends on us returning to it. Adjust the return address accordingly. */
output
(
"
\t
subq $0xb,0x70(%%rcx)
\n
"
);
output
(
"
\t
movl
%s(%%rip),%%r14d
\n
"
,
asm_name
(
"__wine_syscall_flags"
)
);
output
(
"
\t
movl
0xa8(%%rcx),%%r14d
\n
"
);
/* frame->syscall_flags */
output
(
"
\t
testl $3,%%r14d
\n
"
);
/* SYSCALL_HAVE_XSAVE | SYSCALL_HAVE_XSAVEC */
output
(
"
\t
jz 2f
\n
"
);
output
(
"
\t
movl $7,%%eax
\n
"
);
...
...
@@ -1685,7 +1685,7 @@ static void output_syscall_dispatcher(void)
output
(
"5:
\t
movl $0x%x,%%edx
\n
"
,
invalid_param
);
output
(
"
\t
movq %%rsp,%%rcx
\n
"
);
output
(
"%s
\n
"
,
asm_globl
(
"__wine_syscall_dispatcher_return"
)
);
output
(
"
\t
movl
%s(%%rip),%%r14d
\n
"
,
asm_name
(
"__wine_syscall_flags"
)
);
output
(
"
\t
movl
0xa8(%%rcx),%%r14d
\n
"
);
/* frame->syscall_flags */
output
(
"
\t
movq %%rdx,%%rax
\n
"
);
output
(
"
\t
jmp 2b
\n
"
);
break
;
...
...
@@ -1932,9 +1932,6 @@ void output_syscalls( DLLSPEC *spec )
output
(
".Lsyscall_args:
\n
"
);
for
(
i
=
0
;
i
<
count
;
i
++
)
output
(
"
\t
.byte %u
\n
"
,
get_args_size
(
syscalls
[
i
]
));
output
(
"
\t
.align %d
\n
"
,
get_alignment
(
4
)
);
output
(
"%s
\n
"
,
asm_globl
(
"__wine_syscall_flags"
)
);
output
(
"
\t
.long 0
\n
"
);
return
;
}
...
...
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