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
c1a700f0
Commit
c1a700f0
authored
Jan 16, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebuild: Generate Thumb2-compatible assembly code on ARM.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
defa3305
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
33 deletions
+46
-33
import.c
tools/winebuild/import.c
+29
-29
main.c
tools/winebuild/main.c
+2
-0
spec32.c
tools/winebuild/spec32.c
+5
-3
utils.c
tools/winebuild/utils.c
+10
-1
No files found.
tools/winebuild/import.c
View file @
c1a700f0
...
...
@@ -755,9 +755,10 @@ static void output_import_thunk( const char *name, const char *table, int pos )
output
(
"
\t
jmpq *%s+%d(%%rip)
\n
"
,
table
,
pos
);
break
;
case
CPU_ARM
:
output
(
"
\t
ldr IP,1f
\n
"
);
output
(
"
\t
ldr PC,[PC,IP]
\n
"
);
output
(
"1:
\t
.long %s+%u-(1b+4)
\n
"
,
table
,
pos
);
output
(
"
\t
ldr ip, 2f
\n
"
);
output
(
"1:
\t
add ip, pc
\n
"
);
output
(
"
\t
ldr pc, [ip]
\n
"
);
output
(
"2:
\t
.long %s+%u-1b-%u
\n
"
,
table
,
pos
,
thumb_mode
?
4
:
8
);
break
;
case
CPU_ARM64
:
output
(
"
\t
adrp x16, %s
\n
"
,
arm64_page
(
table
)
);
...
...
@@ -956,7 +957,7 @@ static void output_delayed_imports( const DLLSPEC *spec )
struct
import_func
*
func
=
&
import
->
imports
[
j
];
const
char
*
name
=
func
->
name
?
func
->
name
:
func
->
export_name
;
output
(
"__imp_%s:
\n
"
,
asm_name
(
name
));
output
(
"
\t
%s
.L
__wine_delay_imp_%s_%s
\n
"
,
output
(
"
\t
%s __wine_delay_imp_%s_%s
\n
"
,
get_asm_ptr_keyword
(),
import
->
c_name
,
name
);
}
}
...
...
@@ -1066,13 +1067,10 @@ static void output_delayed_import_thunks( const DLLSPEC *spec )
case
CPU_ARM
:
output
(
"
\t
push {r0-r3,FP,LR}
\n
"
);
output
(
"
\t
mov r0,IP
\n
"
);
output
(
"
\t
ldr IP,2f
\n
"
);
output
(
"
\t
add IP,PC
\n
"
);
output
(
"
\t
blx IP
\n
"
);
output
(
"1:
\t
mov IP,r0
\n
"
);
output
(
"
\t
bl %s
\n
"
,
asm_name
(
"__wine_spec_delay_load"
)
);
output
(
"
\t
mov IP,r0
\n
"
);
output
(
"
\t
pop {r0-r3,FP,LR}
\n
"
);
output
(
"
\t
bx IP
\n
"
);
output
(
"2:
\t
.long %s-1b
\n
"
,
asm_name
(
"__wine_spec_delay_load"
)
);
break
;
case
CPU_ARM64
:
output
(
"
\t
stp x29, x30, [sp,#-80]!
\n
"
);
...
...
@@ -1153,7 +1151,8 @@ static void output_delayed_import_thunks( const DLLSPEC *spec )
struct
import_func
*
func
=
&
import
->
imports
[
j
];
const
char
*
name
=
func
->
name
?
func
->
name
:
func
->
export_name
;
output
(
".L__wine_delay_imp_%s_%s:
\n
"
,
import
->
c_name
,
name
);
if
(
thumb_mode
)
output
(
"
\t
.thumb_func
\n
"
);
output
(
"__wine_delay_imp_%s_%s:
\n
"
,
import
->
c_name
,
name
);
output_cfi
(
".cfi_startproc"
);
switch
(
target_cpu
)
{
...
...
@@ -1349,14 +1348,13 @@ void output_stubs( DLLSPEC *spec )
output
(
"
\t
call %s
\n
"
,
asm_name
(
"__wine_spec_unimplemented_stub"
)
);
break
;
case
CPU_ARM
:
output
(
"
\t
ldr r0,2f
\n
"
);
output
(
"
\t
add r0,PC
\n
"
);
output
(
"
\t
ldr r1,2f+4
\n
"
);
output
(
"1:"
);
if
(
exp_name
)
output
(
"
\t
add r1,PC
\n
"
);
output
(
"
\t
ldr r0,3f
\n
"
);
output
(
"1:
\t
add r0,PC
\n
"
);
output
(
"
\t
ldr r1,3f+4
\n
"
);
if
(
exp_name
)
output
(
"2:
\t
add r1,PC
\n
"
);
output
(
"
\t
bl %s
\n
"
,
asm_name
(
"__wine_spec_unimplemented_stub"
)
);
output
(
"
2:
\t
.long .L__wine_spec_file_name-1b
\n
"
);
if
(
exp_name
)
output
(
"
\t
.long .L%s_string-2b
\n
"
,
name
);
output
(
"
3:
\t
.long .L__wine_spec_file_name-1b-%u
\n
"
,
thumb_mode
?
4
:
8
);
if
(
exp_name
)
output
(
"
\t
.long .L%s_string-2b
-%u
\n
"
,
name
,
thumb_mode
?
4
:
8
);
else
output
(
"
\t
.long %u
\n
"
,
odp
->
ordinal
);
break
;
case
CPU_ARM64
:
...
...
@@ -1566,28 +1564,30 @@ void output_syscalls( DLLSPEC *spec )
output
(
"
\t
str ip, [sp, #4]
\n
"
);
output
(
"
\t
str sp, [r7]
\n
"
);
/* syscall frame */
output
(
"
\t
ldr r5, 7f
\n
"
);
output
(
"
\t
add r5, pc
\n
"
);
output
(
"
1:
\t
add r5, pc
\n
"
);
output
(
"
\t
ldrb r5, [r5, r4]
\n
"
);
/* syscall args */
output
(
"
1:
\t
subs r5, #16
\n
"
);
/* first 4 args are in registers */
output
(
"
\t
subs r5, #16
\n
"
);
/* first 4 args are in registers */
output
(
"
\t
ble 3f
\n
"
);
output
(
"
\t
sub sp, r5
\n
"
);
output
(
"
\t
and sp, #~7
\n
"
);
output
(
"
\t
sub ip, sp, r5
\n
"
);
output
(
"
\t
and ip, #~7
\n
"
);
output
(
"
\t
mov sp, ip
\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
bgt 2b
\n
"
);
output
(
"3:
\t
ldr r5, 6f
\n
"
);
output
(
"
\t
add r5, pc
\n
"
);
output
(
"
4:
\t
add r5, pc
\n
"
);
output
(
"
\t
ldr ip, [r5, r4, lsl #2]
\n
"
);
/* syscall table */
output
(
"
4:
\t
blx ip
\n
"
);
output
(
"
\t
blx ip
\n
"
);
output
(
"
\t
mov ip, #0
\n
"
);
output
(
"
\t
str ip, [r7]
\n
"
);
output
(
"
\t
sub sp, r6, #40
\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, 9f
\n
"
);
output
(
"
\t
pop {r5-r11,pc}
\n
"
);
output
(
"6:
\t
.long .Lsyscall_table-4b
\n
"
);
output
(
"7:
\t
.long .Lsyscall_args-1b
\n
"
);
output
(
"6:
\t
.long .Lsyscall_table-4b
-%u
\n
"
,
thumb_mode
?
4
:
8
);
output
(
"7:
\t
.long .Lsyscall_args-1b
-%u
\n
"
,
thumb_mode
?
4
:
8
);
output
(
"8:
\t
.long %u
\n
"
,
count
);
output
(
"9:
\t
.long 0x%x
\n
"
,
invalid_param
);
break
;
...
...
@@ -1731,11 +1731,11 @@ void output_syscalls( DLLSPEC *spec )
output
(
"
\t
push {r4,lr}
\n
"
);
output
(
"
\t
ldr r4, 3f
\n
"
);
output
(
"
\t
ldr ip, 2f
\n
"
);
output
(
"
\t
add ip, pc
\n
"
);
output
(
"
1:
\t
add ip, pc
\n
"
);
output
(
"
\t
ldr ip, [ip]
\n
"
);
output
(
"
1:
\t
blx ip
\n
"
);
output
(
"
\t
blx ip
\n
"
);
output
(
"
\t
pop {r4,pc}
\n
"
);
output
(
"2:
\t
.long %s-1b
\n
"
,
asm_name
(
"__wine_syscall_dispatcher"
)
);
output
(
"2:
\t
.long %s-1b
-%u
\n
"
,
asm_name
(
"__wine_syscall_dispatcher"
),
thumb_mode
?
4
:
8
);
output
(
"3:
\t
.long %u
\n
"
,
i
);
break
;
case
CPU_ARM64
:
...
...
tools/winebuild/main.c
View file @
c1a700f0
...
...
@@ -244,6 +244,8 @@ static void set_target( const char *target )
}
free
(
spec
);
if
(
target_cpu
==
CPU_ARM
&&
target_platform
==
PLATFORM_WINDOWS
)
thumb_mode
=
1
;
}
/* cleanup on program exit */
...
...
tools/winebuild/spec32.c
View file @
c1a700f0
...
...
@@ -249,6 +249,7 @@ static void output_relay_debug( DLLSPEC *spec )
/* then the relay thunks */
output
(
"
\t
.text
\n
"
);
if
(
thumb_mode
)
output
(
"
\t
.thumb_func
\n
"
);
output
(
"__wine_spec_relay_entry_points:
\n
"
);
output
(
"
\t
nop
\n
"
);
/* to avoid 0 offset */
...
...
@@ -306,6 +307,7 @@ static void output_relay_debug( DLLSPEC *spec )
val
=
(
odp
->
u
.
func
.
args_str_offset
<<
16
)
|
(
i
-
spec
->
base
);
output
(
"
\t
.align %d
\n
"
,
get_alignment
(
4
)
);
if
(
thumb_mode
)
output
(
"
\t
.thumb_func
\n
"
);
output
(
".L__wine_spec_relay_entry_point_%d:
\n
"
,
i
);
output_cfi
(
".cfi_startproc"
);
output
(
"
\t
push {r0-r3}
\n
"
);
...
...
@@ -317,13 +319,13 @@ static void output_relay_debug( DLLSPEC *spec )
if
(
val
&
mask
)
output
(
"
\t
%s r1,#%u
\n
"
,
count
++
?
"add"
:
"mov"
,
val
&
mask
);
if
(
!
count
)
output
(
"
\t
mov r1,#0
\n
"
);
output
(
"
\t
ldr r0, 2f
\n
"
);
output
(
"
\t
add r0, PC
\n
"
);
output
(
"
1:
\t
add r0, PC
\n
"
);
output
(
"
\t
ldr IP, [r0, #4]
\n
"
);
output
(
"
1:
\t
blx IP
\n
"
);
output
(
"
\t
blx IP
\n
"
);
output
(
"
\t
ldr IP, [SP, #4]
\n
"
);
output
(
"
\t
add SP, #%u
\n
"
,
24
+
(
has_float
?
64
:
0
)
);
output
(
"
\t
bx IP
\n
"
);
output
(
"2:
\t
.long .L__wine_spec_relay_descr-1b
\n
"
);
output
(
"2:
\t
.long .L__wine_spec_relay_descr-1b
-%u
\n
"
,
thumb_mode
?
4
:
8
);
output_cfi
(
".cfi_endproc"
);
break
;
}
...
...
tools/winebuild/utils.c
View file @
c1a700f0
...
...
@@ -690,6 +690,11 @@ void output_standard_file_header(void)
output
(
"
\t
.globl @feat.00
\n
"
);
output
(
".set @feat.00, 1
\n
"
);
}
if
(
thumb_mode
)
{
output
(
"
\t
.syntax unified
\n
"
);
output
(
"
\t
.thumb
\n
"
);
}
}
/* dump a byte stream into the assembly code */
...
...
@@ -1119,13 +1124,17 @@ const char *func_declaration( const char *func )
return
""
;
case
PLATFORM_WINDOWS
:
free
(
buffer
);
buffer
=
strmake
(
".def %s
\n\t
.scl 2
\n\t
.type 32
\n\t
.endef"
,
asm_name
(
func
)
);
buffer
=
strmake
(
".def %s
\n\t
.scl 2
\n\t
.type 32
\n\t
.endef%s"
,
asm_name
(
func
),
thumb_mode
?
"
\n\t
.thumb_func"
:
""
);
break
;
default:
free
(
buffer
);
switch
(
target_cpu
)
{
case
CPU_ARM
:
buffer
=
strmake
(
".type %s,%%function%s"
,
func
,
thumb_mode
?
"
\n\t
.thumb_func"
:
""
);
break
;
case
CPU_ARM64
:
buffer
=
strmake
(
".type %s,%%function"
,
func
);
break
;
...
...
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