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
2aae74df
Commit
2aae74df
authored
Sep 21, 2005
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factor out a couple of useful helper functions.
parent
c532c866
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
54 deletions
+31
-54
build.h
tools/winebuild/build.h
+2
-3
import.c
tools/winebuild/import.c
+1
-7
relay.c
tools/winebuild/relay.c
+12
-18
res32.c
tools/winebuild/res32.c
+2
-9
utils.c
tools/winebuild/utils.c
+14
-17
No files found.
tools/winebuild/build.h
View file @
2aae74df
...
...
@@ -174,8 +174,7 @@ extern char *get_temp_file_name( const char *prefix, const char *suffix );
extern
void
output_standard_file_header
(
FILE
*
outfile
);
extern
FILE
*
open_input_file
(
const
char
*
srcdir
,
const
char
*
name
);
extern
void
close_input_file
(
FILE
*
file
);
extern
void
dump_bytes
(
FILE
*
outfile
,
const
unsigned
char
*
data
,
int
len
,
const
char
*
label
,
int
constant
);
extern
void
dump_bytes
(
FILE
*
outfile
,
const
void
*
buffer
,
unsigned
int
size
);
extern
int
remove_stdcall_decoration
(
char
*
name
);
extern
void
assemble_file
(
const
char
*
src_file
,
const
char
*
obj_file
);
extern
DLLSPEC
*
alloc_dll_spec
(
void
);
...
...
@@ -187,12 +186,12 @@ extern unsigned int get_page_size(void);
extern
unsigned
int
get_ptr_size
(
void
);
extern
const
char
*
asm_name
(
const
char
*
func
);
extern
const
char
*
func_declaration
(
const
char
*
func
);
extern
const
char
*
func_size
(
const
char
*
func
);
extern
const
char
*
asm_globl
(
const
char
*
func
);
extern
const
char
*
get_asm_ptr_keyword
(
void
);
extern
const
char
*
get_asm_string_keyword
(
void
);
extern
const
char
*
get_asm_short_keyword
(
void
);
extern
const
char
*
get_asm_string_section
(
void
);
extern
void
output_function_size
(
FILE
*
outfile
,
const
char
*
name
);
extern
void
add_import_dll
(
const
char
*
name
,
const
char
*
filename
);
extern
void
add_delayed_import
(
const
char
*
name
);
...
...
tools/winebuild/import.c
View file @
2aae74df
...
...
@@ -205,12 +205,6 @@ inline static ORDDEF *find_export( const char *name, ORDDEF **table, int size )
return
res
?
*
res
:
NULL
;
}
inline
static
void
output_function_size
(
FILE
*
outfile
,
const
char
*
name
)
{
const
char
*
size
=
func_size
(
name
);
if
(
size
[
0
])
fprintf
(
outfile
,
"
\t
%s
\n
"
,
size
);
}
/* free an import structure */
static
void
free_imports
(
struct
import
*
imp
)
{
...
...
@@ -1220,7 +1214,7 @@ void output_stubs( FILE *outfile, DLLSPEC *spec )
fprintf
(
outfile
,
"
\t
pushl $.L__wine_spec_file_name
\n
"
);
}
fprintf
(
outfile
,
"
\t
call %s
\n
"
,
asm_name
(
"__wine_spec_unimplemented_stub"
)
);
fprintf
(
outfile
,
"
\t
%s
\n
"
,
func_size
(
name
)
);
output_function_size
(
outfile
,
name
);
}
if
(
pos
)
...
...
tools/winebuild/relay.c
View file @
2aae74df
...
...
@@ -40,12 +40,6 @@ static void function_header( FILE *outfile, const char *name )
}
static
void
function_footer
(
FILE
*
outfile
,
const
char
*
name
)
{
const
char
*
size
=
func_size
(
name
);
if
(
size
[
0
])
fprintf
(
outfile
,
"
\t
%s
\n
"
,
size
);
}
static
inline
const
char
*
data16_prefix
(
void
)
{
return
(
target_platform
==
PLATFORM_SVR4
)
?
"
\t
data16
\n
"
:
""
;
...
...
@@ -350,9 +344,9 @@ static void BuildCallFrom16Core( FILE *outfile, int reg_func, int thunk )
/* Return to return stub which will return to caller */
fprintf
(
outfile
,
"
\t
lret $12
\n
"
);
}
if
(
thunk
)
function_footer
(
outfile
,
"__wine_call_from_16_thunk"
);
else
if
(
reg_func
)
function_footer
(
outfile
,
"__wine_call_from_16_regs"
);
else
function_footer
(
outfile
,
"__wine_call_from_16"
);
if
(
thunk
)
output_function_size
(
outfile
,
"__wine_call_from_16_thunk"
);
else
if
(
reg_func
)
output_function_size
(
outfile
,
"__wine_call_from_16_regs"
);
else
output_function_size
(
outfile
,
"__wine_call_from_16"
);
}
...
...
@@ -513,7 +507,7 @@ static void BuildCallTo16Core( FILE *outfile, int reg_func )
fprintf
(
outfile
,
"
\t
lret
\n
"
);
/* Function footer */
function_footer
(
outfile
,
name
);
output_function_size
(
outfile
,
name
);
}
...
...
@@ -549,7 +543,7 @@ static void BuildRet16Func( FILE *outfile )
/* Return to caller */
fprintf
(
outfile
,
"
\t
lret
\n
"
);
function_footer
(
outfile
,
"__wine_call_to_16_ret"
);
output_function_size
(
outfile
,
"__wine_call_to_16_ret"
);
}
...
...
@@ -695,7 +689,7 @@ static void BuildCallTo32CBClient( FILE *outfile, BOOL isEx )
fprintf
(
outfile
,
"
\t
popl %%edi
\n
"
);
fprintf
(
outfile
,
"
\t
popl %%ebp
\n
"
);
fprintf
(
outfile
,
"
\t
ret
\n
"
);
function_footer
(
outfile
,
isEx
?
"CALL32_CBClientEx"
:
"CALL32_CBClient"
);
output_function_size
(
outfile
,
isEx
?
"CALL32_CBClientEx"
:
"CALL32_CBClient"
);
/* '16-bit' return stub */
...
...
@@ -713,7 +707,7 @@ static void BuildCallTo32CBClient( FILE *outfile, BOOL isEx )
fprintf
(
outfile
,
"
\t
lssl %%ss:-12(%%ebx), %%esp
\n
"
);
}
fprintf
(
outfile
,
"
\t
lret
\n
"
);
function_footer
(
outfile
,
isEx
?
"CALL32_CBClientEx_Ret"
:
"CALL32_CBClient_Ret"
);
output_function_size
(
outfile
,
isEx
?
"CALL32_CBClientEx_Ret"
:
"CALL32_CBClient_Ret"
);
}
...
...
@@ -842,12 +836,12 @@ static void BuildCallFrom32Regs( FILE *outfile )
fprintf
(
outfile
,
"
\t
popl %%ds
\n
"
);
fprintf
(
outfile
,
"
\t
iret
\n
"
);
function_footer
(
outfile
,
"__wine_call_from_32_regs"
);
output_function_size
(
outfile
,
"__wine_call_from_32_regs"
);
function_header
(
outfile
,
"__wine_call_from_32_restore_regs"
);
fprintf
(
outfile
,
"
\t
leal 4(%%esp),%%ecx
\n
"
);
fprintf
(
outfile
,
"
\t
jmp 2b
\n
"
);
function_footer
(
outfile
,
"__wine_call_from_32_restore_regs"
);
output_function_size
(
outfile
,
"__wine_call_from_32_restore_regs"
);
}
...
...
@@ -898,7 +892,7 @@ static void BuildPendingEventCheck( FILE *outfile )
fprintf
(
outfile
,
"%s
\n
"
,
asm_globl
(
"DPMI_PendingEventCheck_Return"
)
);
fprintf
(
outfile
,
"
\t
iret
\n
"
);
function_footer
(
outfile
,
"DPMI_PendingEventCheck"
);
output_function_size
(
outfile
,
"DPMI_PendingEventCheck"
);
}
...
...
@@ -952,7 +946,7 @@ void BuildRelays16( FILE *outfile )
BuildPendingEventCheck
(
outfile
);
fprintf
(
outfile
,
"%s
\n
"
,
asm_globl
(
"__wine_call16_end"
)
);
function_footer
(
outfile
,
"__wine_spec_thunk_text_16"
);
output_function_size
(
outfile
,
"__wine_spec_thunk_text_16"
);
/* Declare the return address and data selector variables */
fprintf
(
outfile
,
"
\n\t
.data
\n\t
.align %d
\n
"
,
get_alignment
(
4
)
);
...
...
@@ -983,5 +977,5 @@ void BuildRelays32( FILE *outfile )
/* 32-bit register entry point */
BuildCallFrom32Regs
(
outfile
);
function_footer
(
outfile
,
"__wine_spec_thunk_text_32"
);
output_function_size
(
outfile
,
"__wine_spec_thunk_text_32"
);
}
tools/winebuild/res32.c
View file @
2aae74df
...
...
@@ -340,7 +340,7 @@ static inline void output_res_dir( FILE *outfile, unsigned int nb_names, unsigne
/* output the resource definitions */
void
output_resources
(
FILE
*
outfile
,
DLLSPEC
*
spec
)
{
int
j
,
k
,
nb_id_types
;
int
k
,
nb_id_types
;
unsigned
int
i
,
n
,
offset
,
data_offset
;
struct
res_tree
*
tree
;
struct
res_type
*
type
;
...
...
@@ -453,16 +453,9 @@ void output_resources( FILE *outfile, DLLSPEC *spec )
for
(
i
=
0
,
res
=
spec
->
resources
;
i
<
spec
->
nb_resources
;
i
++
,
res
++
)
{
const
unsigned
char
*
p
=
res
->
data
;
fprintf
(
outfile
,
"
\n\t
.align %d
\n
"
,
get_alignment
(
get_ptr_size
())
);
fprintf
(
outfile
,
".L__wine_spec_res_%d:
\n
"
,
i
);
fprintf
(
outfile
,
"
\t
.byte "
);
for
(
j
=
0
;
j
<
res
->
data_size
-
1
;
j
++
,
p
++
)
{
if
((
j
%
16
)
==
15
)
fprintf
(
outfile
,
"0x%02x
\n\t
.byte "
,
*
p
);
else
fprintf
(
outfile
,
"0x%02x,"
,
*
p
);
}
fprintf
(
outfile
,
"0x%02x
\n
"
,
*
p
);
dump_bytes
(
outfile
,
res
->
data
,
res
->
data_size
);
}
fprintf
(
outfile
,
".L__wine_spec_resources_end:
\n
"
);
fprintf
(
outfile
,
"
\t
.byte 0
\n
"
);
...
...
tools/winebuild/utils.c
View file @
2aae74df
...
...
@@ -205,20 +205,19 @@ void output_standard_file_header( FILE *outfile )
}
/* dump a byte stream into the assembly code */
void
dump_bytes
(
FILE
*
outfile
,
const
unsigned
char
*
data
,
int
len
,
const
char
*
label
,
int
constant
)
void
dump_bytes
(
FILE
*
outfile
,
const
void
*
buffer
,
unsigned
int
size
)
{
int
i
;
unsigned
int
i
;
const
unsigned
char
*
ptr
=
buffer
;
fprintf
(
outfile
,
"
\n
static %sunsigned char %s[%d] = {"
,
constant
?
"const "
:
""
,
label
,
len
);
for
(
i
=
0
;
i
<
len
;
i
++
)
if
(
!
size
)
return
;
fprintf
(
outfile
,
"
\t
.byte "
);
for
(
i
=
0
;
i
<
size
-
1
;
i
++
,
ptr
++
)
{
if
(
!
(
i
&
7
))
fprintf
(
outfile
,
"
\n
"
);
fprintf
(
outfile
,
"0x%02x"
,
*
data
++
);
if
(
i
<
len
-
1
)
fprintf
(
outfile
,
","
);
if
((
i
%
16
)
==
15
)
fprintf
(
outfile
,
"0x%02x
\n\t
.byte "
,
*
ptr
);
else
fprintf
(
outfile
,
"0x%02x,"
,
*
ptr
);
}
fprintf
(
outfile
,
"
\n
};
\n
"
);
fprintf
(
outfile
,
"
0x%02x
\n
"
,
*
ptr
);
}
...
...
@@ -523,19 +522,17 @@ const char *func_declaration( const char *func )
return
buffer
;
}
/*
return
a size declaration for an assembly function */
const
char
*
func_size
(
const
char
*
func
)
/*
output
a size declaration for an assembly function */
void
output_function_size
(
FILE
*
outfile
,
const
char
*
name
)
{
static
char
buffer
[
256
];
switch
(
target_platform
)
{
case
PLATFORM_APPLE
:
case
PLATFORM_WINDOWS
:
return
""
;
break
;
default:
sprintf
(
buffer
,
".size %s, .-%s"
,
func
,
func
);
return
buffer
;
fprintf
(
outfile
,
"
\t
.size %s, .-%s
\n
"
,
name
,
name
);
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