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
20715ee3
Commit
20715ee3
authored
Jul 08, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebuild: Generate Windows-style syscall thunks on x86.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
82cd85b0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
8 deletions
+46
-8
import.c
tools/winebuild/import.c
+46
-8
No files found.
tools/winebuild/import.c
View file @
20715ee3
...
...
@@ -1441,19 +1441,47 @@ void output_syscalls( DLLSPEC *spec )
switch
(
target_cpu
)
{
case
CPU_x86
:
output
(
"
\t
pushl %%ebp
\n
"
);
output_cfi
(
".cfi_adjust_cfa_offset 4
\n
"
);
output_cfi
(
".cfi_rel_offset %%ebp,0
\n
"
);
output
(
"
\t
movl %%esp,%%ebp
\n
"
);
output_cfi
(
".cfi_def_cfa_register %%ebp
\n
"
);
output
(
"
\t
pushl %%esi
\n
"
);
output_cfi
(
".cfi_rel_offset %%esi,-4
\n
"
);
output
(
"
\t
pushl %%edi
\n
"
);
output_cfi
(
".cfi_rel_offset %%edi,-8
\n
"
);
output
(
"
\t
cmpl $%u,%%eax
\n
"
,
count
);
output
(
"
\t
jae 1f
\n
"
);
output
(
"
\t
addl $4,%%esp
\n
"
);
output
(
"
\t
jae 3f
\n
"
);
if
(
UsePIC
)
{
output
(
"
\t
movl %%eax,%%edx
\n
"
);
output
(
"
\t
call %s
\n
"
,
asm_name
(
"__wine_spec_get_pc_thunk_eax"
)
);
output
(
"1:
\t
jmp *.Lsyscall_table-1b(%%eax,%%edx,4)
\n
"
);
output
(
"1:
\t
movzbl .Lsyscall_args-1b(%%eax,%%edx,1),%%ecx
\n
"
);
needs_get_pc_thunk
=
1
;
}
else
output
(
"
\t
jmp *.Lsyscall_table(,%%eax,4)
\n
"
);
output
(
"1:
\t
movl $0x%x,%%eax
\n
"
,
invalid_param
);
else
output
(
"
\t
movzbl .Lsyscall_args(%%eax),%%ecx
\n
"
);
output
(
"
\t
subl %%ecx,%%esp
\n
"
);
output
(
"
\t
shrl $2,%%ecx
\n
"
);
output
(
"
\t
leal 12(%%ebp),%%esi
\n
"
);
output
(
"
\t
andl $~15,%%esp
\n
"
);
output
(
"
\t
movl %%esp,%%edi
\n
"
);
output
(
"
\t
cld
\n
"
);
output
(
"
\t
rep; movsl
\n
"
);
if
(
UsePIC
)
output
(
"
\t
call *.Lsyscall_table-1b(%%eax,%%edx,4)
\n
"
);
else
output
(
"
\t
call *.Lsyscall_table(,%%eax,4)
\n
"
);
output
(
"
\t
leal -8(%%ebp),%%esp
\n
"
);
output
(
"2:
\t
popl %%edi
\n
"
);
output_cfi
(
".cfi_same_value %%edi
\n
"
);
output
(
"
\t
popl %%esi
\n
"
);
output_cfi
(
".cfi_same_value %%esi
\n
"
);
output
(
"
\t
popl %%ebp
\n
"
);
output_cfi
(
".cfi_def_cfa %%esp,4
\n
"
);
output_cfi
(
".cfi_same_value %%ebp
\n
"
);
output
(
"
\t
ret
\n
"
);
output
(
"3:
\t
movl $0x%x,%%eax
\n
"
,
invalid_param
);
output
(
"
\t
jmp 2b
\n
"
);
break
;
case
CPU_x86_64
:
output
(
"
\t
cmpq $%u,%%rax
\n
"
,
count
);
...
...
@@ -1501,6 +1529,9 @@ void output_syscalls( DLLSPEC *spec )
output
(
".Lsyscall_table:
\n
"
);
for
(
i
=
0
;
i
<
count
;
i
++
)
output
(
"
\t
%s %s
\n
"
,
get_asm_ptr_keyword
(),
asm_name
(
get_link_name
(
syscalls
[
i
]
)));
output
(
".Lsyscall_args:
\n
"
);
for
(
i
=
0
;
i
<
count
;
i
++
)
output
(
"
\t
.byte %u
\n
"
,
get_args_size
(
syscalls
[
i
]
));
return
;
}
...
...
@@ -1515,20 +1546,19 @@ void output_syscalls( DLLSPEC *spec )
switch
(
target_cpu
)
{
case
CPU_x86
:
/* FIXME: syscall thunks not binary-compatible yet */
if
(
UsePIC
)
{
output
(
"
\t
call %s
\n
"
,
asm_name
(
"__wine_spec_get_pc_thunk_eax"
)
);
output
(
"1:
\t
movl %s-1b(%%eax),%%edx
\n
"
,
asm_name
(
"__wine_syscall_dispatcher"
)
);
output
(
"
\t
movl $%u,%%eax
\n
"
,
i
);
output
(
"
\t
call *%%edx
\n
"
);
needs_get_pc_thunk
=
1
;
}
else
{
output
(
"
\t
movl $%u,%%eax
\n
"
,
i
);
output
(
"
\t
call *(%s)
\n
"
,
asm_name
(
"__wine_syscall_dispatcher"
)
);
output
(
"
\t
movl $__wine_syscall,%%edx
\n
"
);
}
output
(
"
\t
call *%%edx
\n
"
);
output
(
"
\t
ret $%u
\n
"
,
get_args_size
(
odp
));
break
;
case
CPU_x86_64
:
...
...
@@ -1559,6 +1589,14 @@ void output_syscalls( DLLSPEC *spec )
output_function_size
(
name
);
}
if
(
target_cpu
==
CPU_x86
&&
!
UsePIC
)
{
output
(
"
\t
.align %d
\n
"
,
get_alignment
(
16
)
);
output
(
"
\t
%s
\n
"
,
func_declaration
(
"__wine_syscall"
)
);
output
(
"__wine_syscall:
\n
"
);
output
(
"
\t
jmp *(%s)
\n
"
,
asm_name
(
"__wine_syscall_dispatcher"
)
);
output_function_size
(
"__wine_syscall"
);
}
output
(
"
\t
.data
\n
"
);
output
(
"
\t
.align %d
\n
"
,
get_alignment
(
get_ptr_size
()
)
);
output
(
"%s
\n
"
,
asm_globl
(
"__wine_syscall_dispatcher"
)
);
...
...
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