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
11e3d43c
Commit
11e3d43c
authored
Feb 19, 2021
by
Jacek Caban
Committed by
Alexandre Julliard
Feb 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Store x86_64 YMM context in syscall frame.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a06d60bd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
15 deletions
+50
-15
signal_x86_64.c
dlls/ntdll/unix/signal_x86_64.c
+15
-5
import.c
tools/winebuild/import.c
+35
-10
No files found.
dlls/ntdll/unix/signal_x86_64.c
View file @
11e3d43c
...
...
@@ -270,9 +270,10 @@ C_ASSERT( sizeof(struct apc_stack_layout) == 0x510 );
struct
syscall_xsave
{
XMM_SAVE_AREA32
xsave
;
XSTATE
xstate
;
};
C_ASSERT
(
sizeof
(
struct
syscall_xsave
)
==
0x
20
0
);
C_ASSERT
(
sizeof
(
struct
syscall_xsave
)
==
0x
34
0
);
struct
syscall_frame
{
...
...
@@ -2147,7 +2148,7 @@ __ASM_GLOBAL_FUNC( call_user_apc_dispatcher,
__ASM_GLOBAL_FUNC
(
call_raise_user_exception_dispatcher
,
"movq %gs:0x30,%rdx
\n\t
"
"movq 0x328(%rdx),%rax
\n\t
"
/* amd64_thread_data()->syscall_frame */
"leaq -0x
20
0(%rax),%r8
\n\t
"
"leaq -0x
34
0(%rax),%r8
\n\t
"
"andq $~63,%r8
\n\t
"
"fxrstor64 (%r8)
\n\t
"
"movq 0x8(%rax),%rbx
\n\t
"
/* frame->rbx */
...
...
@@ -2793,14 +2794,23 @@ void signal_init_process(void)
*/
void
*
signal_init_syscalls
(
void
)
{
void
*
ptr
;
SYSTEM_CPU_INFORMATION
cpu_info
;
void
*
ptr
,
*
syscall_dispatcher
;
extern
void
__wine_syscall_dispatcher_xsave
(
void
)
DECLSPEC_HIDDEN
;
NtQuerySystemInformation
(
SystemCpuInformation
,
&
cpu_info
,
sizeof
(
cpu_info
),
NULL
);
if
(
cpu_info
.
FeatureSet
&
CPU_FEATURE_XSAVE
)
syscall_dispatcher
=
__wine_syscall_dispatcher_xsave
;
else
syscall_dispatcher
=
__wine_syscall_dispatcher
;
/* sneak in a syscall dispatcher pointer at a fixed address (7ffe1000) */
ptr
=
(
char
*
)
user_shared_data
+
page_size
;
anon_mmap_fixed
(
ptr
,
page_size
,
PROT_READ
|
PROT_WRITE
,
0
);
*
(
void
**
)
ptr
=
__wine_
syscall_dispatcher
;
*
(
void
**
)
ptr
=
syscall_dispatcher
;
return
__wine_
syscall_dispatcher
;
return
syscall_dispatcher
;
}
...
...
tools/winebuild/import.c
View file @
11e3d43c
...
...
@@ -1426,13 +1426,14 @@ static int cmp_link_name( const void *e1, const void *e2 )
/* output dispatcher for system calls */
static
void
output_syscall_dispatcher
(
int
count
)
static
void
output_syscall_dispatcher
(
int
count
,
const
char
*
variant
)
{
const
unsigned
int
invalid_param
=
0xc000000d
;
/* STATUS_INVALID_PARAMETER */
const
char
*
symbol
=
strmake
(
"__wine_syscall_dispatcher%s"
,
variant
);
output
(
"
\t
.align %d
\n
"
,
get_alignment
(
4
)
);
output
(
"
\t
%s
\n
"
,
func_declaration
(
"__wine_syscall_dispatcher"
)
);
output
(
"%s
\n
"
,
asm_globl
(
"__wine_syscall_dispatcher"
)
);
output
(
"
\t
%s
\n
"
,
func_declaration
(
symbol
)
);
output
(
"%s
\n
"
,
asm_globl
(
symbol
)
);
output_cfi
(
".cfi_startproc"
);
switch
(
target_cpu
)
{
...
...
@@ -1493,7 +1494,7 @@ static void output_syscall_dispatcher( int count )
output_cfi
(
".cfi_def_cfa_register %%rbp"
);
output
(
"
\t
leaq -0x10(%%rbp),%%rsp
\n
"
);
output
(
"
\t
pushfq
\n
"
);
output
(
"
\t
subq $0x
28
0,%%rsp
\n
"
);
output
(
"
\t
subq $0x
3c
0,%%rsp
\n
"
);
output
(
"
\t
andq $~63,%%rsp
\n
"
);
output
(
"
\t
movq %%rbx,-0x90(%%rbp)
\n
"
);
output_cfi
(
".cfi_rel_offset %%rbx,-144"
);
...
...
@@ -1520,14 +1521,29 @@ static void output_syscall_dispatcher( int count )
output
(
"
\t
movw %%ss,-0x8(%%rbp)
\n
"
);
output
(
"
\t
movw %%gs,-0x6(%%rbp)
\n
"
);
output
(
"
\t
movq %%rsp,%%r12
\n
"
);
output
(
"
\t
fxsave64 (%%r12)
\n
"
);
output
(
"
\t
movq %%rax,%%r11
\n
"
);
if
(
!*
variant
)
{
output
(
"
\t
fxsave64 (%%r12)
\n
"
);
}
else
{
output
(
"
\t
movl $7,%%eax
\n
"
);
output
(
"
\t
movq %%rdx,%%rsi
\n
"
);
output
(
"
\t
xorq %%rdx,%%rdx
\n
"
);
output
(
"
\t
movq %%rdx,0x200(%%r12)
\n
"
);
output
(
"
\t
movq %%rdx,0x208(%%r12)
\n
"
);
output
(
"
\t
movq %%rdx,0x210(%%r12)
\n
"
);
output
(
"
\t
xsave64 (%%r12)
\n
"
);
output
(
"
\t
movq %%rsi,%%rdx
\n
"
);
}
output
(
"
\t
movq %%gs:0x30,%%rcx
\n
"
);
output
(
"
\t
leaq -0x98(%%rbp),%%rbx
\n
"
);
output
(
"
\t
movq %%rbx,0x328(%%rcx)
\n
"
);
/* amd64_thread_data()->syscall_frame */
output
(
"
\t
cmpq $%u,%%r
ax
\n
"
,
count
);
output
(
"
\t
cmpq $%u,%%r
11
\n
"
,
count
);
output
(
"
\t
jae 3f
\n
"
);
output
(
"
\t
leaq .Lsyscall_args(%%rip),%%rcx
\n
"
);
output
(
"
\t
movzbl (%%rcx,%%r
ax
),%%ecx
\n
"
);
output
(
"
\t
movzbl (%%rcx,%%r
11
),%%ecx
\n
"
);
output
(
"
\t
subq $0x20,%%rcx
\n
"
);
output
(
"
\t
jbe 1f
\n
"
);
output
(
"
\t
subq %%rcx,%%rsp
\n
"
);
...
...
@@ -1540,7 +1556,7 @@ static void output_syscall_dispatcher( int count )
output
(
"1:
\t
movq %%r10,%%rcx
\n
"
);
output
(
"
\t
subq $0x20,%%rsp
\n
"
);
output
(
"
\t
leaq .Lsyscall_table(%%rip),%%r10
\n
"
);
output
(
"
\t
callq *(%%r10,%%r
ax
,8)
\n
"
);
output
(
"
\t
callq *(%%r10,%%r
11
,8)
\n
"
);
output
(
"2:
\t
movq %%gs:0x30,%%rcx
\n
"
);
output
(
"
\t
movq $0,0x328(%%rcx)
\n
"
);
output
(
"
\t
fxrstor64 (%%r12)
\n
"
);
...
...
@@ -1682,7 +1698,7 @@ static void output_syscall_dispatcher( int count )
assert
(
0
);
}
output_cfi
(
".cfi_endproc"
);
output_function_size
(
"__wine_syscall_dispatcher"
);
output_function_size
(
symbol
);
}
...
...
@@ -1707,7 +1723,16 @@ void output_syscalls( DLLSPEC *spec )
if
(
unix_lib
)
{
output_syscall_dispatcher
(
count
);
output_syscall_dispatcher
(
count
,
""
);
switch
(
target_cpu
)
{
case
CPU_x86_64
:
output_syscall_dispatcher
(
count
,
"_xsave"
);
break
;
default:
break
;
}
output
(
"
\t
.data
\n
"
);
output
(
"
\t
.align %d
\n
"
,
get_alignment
(
get_ptr_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