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
543e4939
Commit
543e4939
authored
May 27, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebuild: Store all parameters on the stack for syscall thunks on ARM.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
4a9936e3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
38 deletions
+55
-38
signal_arm.c
dlls/ntdll/unix/signal_arm.c
+2
-2
import.c
tools/winebuild/import.c
+53
-36
No files found.
dlls/ntdll/unix/signal_arm.c
View file @
543e4939
...
...
@@ -174,6 +174,7 @@ struct syscall_frame
{
DWORD
pad
;
DWORD
cpsr
;
DWORD
r4
;
DWORD
r5
;
DWORD
r6
;
DWORD
r7
;
...
...
@@ -181,9 +182,8 @@ struct syscall_frame
DWORD
r9
;
DWORD
r10
;
DWORD
r11
;
DWORD
thunk_addr
;
DWORD
r4
;
DWORD
ret_addr
;
DWORD
thunk_addr
;
};
struct
arm_thread_data
...
...
tools/winebuild/import.c
View file @
543e4939
...
...
@@ -1697,41 +1697,44 @@ static void output_syscall_dispatcher( int count, const char *variant )
output
(
"
\t
jmp 2b
\n
"
);
break
;
case
CPU_ARM
:
output
(
"
\t
push {r
5-r11,lr
}
\n
"
);
output
(
"
\t
push {r
4-r11
}
\n
"
);
output
(
"
\t
add r6, sp, #40
\n
"
);
/* stack parameters */
output
(
"
\t
ldr r5, 6f+8
\n
"
);
output
(
"
\t
cmp
r4
, r5
\n
"
);
output
(
"
\t
cmp
ip
, r5
\n
"
);
output
(
"
\t
bcs 5f
\n
"
);
output
(
"
\t
sub sp, sp, #8
\n
"
);
output
(
"
\t
mrc p15, 0, r7, c13, c0, 2
\n
"
);
/* NtCurrentTeb() */
output
(
"
\t
add r7, #0x1d8
\n
"
);
/* arm_thread_data()->syscall_frame */
output
(
"
\t
mrs
ip
, CPSR
\n
"
);
output
(
"
\t
bfi
ip
, lr, #5, #1
\n
"
);
/* set thumb bit */
output
(
"
\t
str
ip
, [sp, #4]
\n
"
);
output
(
"
\t
mrs
r0
, CPSR
\n
"
);
output
(
"
\t
bfi
r0
, lr, #5, #1
\n
"
);
/* set thumb bit */
output
(
"
\t
str
r0
, [sp, #4]
\n
"
);
output
(
"
\t
str sp, [r7]
\n
"
);
/* syscall frame */
output
(
"
\t
ldr r5, 6f+4
\n
"
);
if
(
UsePIC
)
output
(
"1:
\t
add r5, pc
\n
"
);
output
(
"
\t
ldrb r5, [r5, r4]
\n
"
);
/* syscall args */
output
(
"
\t
subs r5, #16
\n
"
);
/* first 4 args are in registers */
output
(
"
\t
ble 3f
\n
"
);
output
(
"
\t
sub ip, sp, r5
\n
"
);
output
(
"
\t
and ip, #~7
\n
"
);
output
(
"
\t
mov sp, ip
\n
"
);
output
(
"
\t
ldrb r5, [r5, ip]
\n
"
);
/* syscall args */
output
(
"
\t
cmp r5, #16
\n
"
);
output
(
"
\t
it le
\n
"
);
output
(
"
\t
movle r5, #16
\n
"
);
output
(
"
\t
sub r0, sp, r5
\n
"
);
output
(
"
\t
and r0, #~7
\n
"
);
output
(
"
\t
mov sp, r0
\n
"
);
output
(
"2:
\t
subs r5, r5, #4
\n
"
);
output
(
"
\t
ldr
ip
, [r6, r5]
\n
"
);
output
(
"
\t
str
ip
, [sp, r5]
\n
"
);
output
(
"
\t
ldr
r0
, [r6, r5]
\n
"
);
output
(
"
\t
str
r0
, [sp, r5]
\n
"
);
output
(
"
\t
bgt 2b
\n
"
);
output
(
"
3:
\t
ldr r5, 6f
\n
"
);
output
(
"
\t
ldr r5, 6f
\n
"
);
if
(
UsePIC
)
output
(
"4:
\t
add r5, pc
\n
"
);
output
(
"
\t
ldr ip, [r5, r4, lsl #2]
\n
"
);
/* syscall table */
output
(
"
\t
ldr ip, [r5, ip, lsl #2]
\n
"
);
/* syscall table */
output
(
"
\t
pop {r0-r3}
\n
"
);
/* first 4 args are in registers */
output
(
"
\t
blx ip
\n
"
);
output
(
"
\t
mov ip, #0
\n
"
);
output
(
"
\t
str ip, [r7]
\n
"
);
output
(
"
\t
sub ip, r6, #40
\n
"
);
output
(
"
\t
mov sp, ip
\n
"
);
output
(
"
\t
pop {r5-r11,pc}
\n
"
);
output
(
"5:
\t
ldr r0, 6f+12
\n
"
);
output
(
"
\t
pop {r5-r11,pc}
\n
"
);
output
(
"
\t
pop {r4-r12,pc}
\n
"
);
output
(
"5:
\t
movw r0, #0x%x
\n
"
,
invalid_param
&
0xffff
);
output
(
"
\t
movt r0, #0x%x
\n
"
,
invalid_param
>>
16
);
output
(
"
\t
pop {r4-r12,pc}
\n
"
);
if
(
UsePIC
)
{
output
(
"6:
\t
.long .Lsyscall_table-4b-%u
\n
"
,
thumb_mode
?
4
:
8
);
...
...
@@ -1743,7 +1746,6 @@ static void output_syscall_dispatcher( int count, const char *variant )
output
(
"
\t
.long .Lsyscall_args
\n
"
);
}
output
(
"
\t
.long %u
\n
"
,
count
);
output
(
"
\t
.long 0x%x
\n
"
,
invalid_param
);
break
;
case
CPU_ARM64
:
output
(
"
\t
cmp x8, %u
\n
"
,
count
);
...
...
@@ -1922,22 +1924,12 @@ void output_syscalls( DLLSPEC *spec )
output
(
"
\t
ret
\n
"
);
break
;
case
CPU_ARM
:
output
(
"
\t
push {r4,lr}
\n
"
);
output
(
"
\t
mov r4, #%u
\n
"
,
i
);
if
(
UsePIC
)
{
output
(
"
\t
ldr ip, 2f
\n
"
);
output
(
"1:
\t
add ip, pc
\n
"
);
}
else
{
output
(
"
\t
movw ip, :lower16:%s
\n
"
,
asm_name
(
"__wine_syscall_dispatcher"
)
);
output
(
"
\t
movt ip, :upper16:%s
\n
"
,
asm_name
(
"__wine_syscall_dispatcher"
)
);
}
output
(
"
\t
ldr ip, [ip]
\n
"
);
output
(
"
\t
blx ip
\n
"
);
output
(
"
\t
pop {r4,pc}
\n
"
);
if
(
UsePIC
)
output
(
"2:
\t
.long %s-1b-%u
\n
"
,
asm_name
(
"__wine_syscall_dispatcher"
),
thumb_mode
?
4
:
8
);
output
(
"
\t
push {r0-r3}
\n
"
);
output
(
"
\t
movw ip, #%u
\n
"
,
i
);
output
(
"
\t
mov r3, lr
\n
"
);
output
(
"
\t
bl %s
\n
"
,
asm_name
(
"__wine_syscall"
)
);
output
(
"
\t
add sp, #16
\n
"
);
output
(
"
\t
bx ip
\n
"
);
break
;
case
CPU_ARM64
:
output
(
"
\t
stp x29, x30, [sp,#-16]!
\n
"
);
...
...
@@ -1958,13 +1950,38 @@ void output_syscalls( DLLSPEC *spec )
output_function_size
(
name
);
}
if
(
target_cpu
==
CPU_x86
&&
!
UsePIC
)
switch
(
target_cpu
)
{
case
CPU_x86
:
if
(
UsePIC
)
break
;
output
(
"
\t
.align %d
\n
"
,
get_alignment
(
16
)
);
output
(
"
\t
%s
\n
"
,
func_declaration
(
"__wine_syscall"
)
);
output
(
"%s:
\n
"
,
asm_name
(
"__wine_syscall"
)
);
output
(
"
\t
jmp *(%s)
\n
"
,
asm_name
(
"__wine_syscall_dispatcher"
)
);
output_function_size
(
"__wine_syscall"
);
break
;
case
CPU_ARM
:
output
(
"
\t
.align %d
\n
"
,
get_alignment
(
16
)
);
output
(
"
\t
%s
\n
"
,
func_declaration
(
"__wine_syscall"
)
);
output
(
"%s:
\n
"
,
asm_name
(
"__wine_syscall"
)
);
output
(
"
\t
push {r3,lr}
\n
"
);
if
(
UsePIC
)
{
output
(
"
\t
ldr r0, 2f
\n
"
);
output
(
"1:
\t
add r0, pc
\n
"
);
}
else
{
output
(
"
\t
movw r0, :lower16:%s
\n
"
,
asm_name
(
"__wine_syscall_dispatcher"
)
);
output
(
"
\t
movt r0, :upper16:%s
\n
"
,
asm_name
(
"__wine_syscall_dispatcher"
)
);
}
output
(
"
\t
ldr r0, [r0]
\n
"
);
output
(
"
\t
bx r0
\n
"
);
if
(
UsePIC
)
output
(
"2:
\t
.long %s-1b-%u
\n
"
,
asm_name
(
"__wine_syscall_dispatcher"
),
thumb_mode
?
4
:
8
);
output_function_size
(
"__wine_syscall"
);
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