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
c9f0bea9
Commit
c9f0bea9
authored
Mar 26, 2008
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libwine: Added a wine_call_on_stack function.
parent
f6d871ee
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
68 additions
and
1 deletion
+68
-1
library.h
include/wine/library.h
+1
-0
port.c
libs/wine/port.c
+64
-0
wine.def
libs/wine/wine.def
+2
-1
wine.map
libs/wine/wine.map
+1
-0
No files found.
include/wine/library.h
View file @
c9f0bea9
...
...
@@ -66,6 +66,7 @@ extern void wine_init( int argc, char *argv[], char *error, int error_size );
/* portability */
extern
void
DECLSPEC_NORETURN
wine_switch_to_stack
(
void
(
*
func
)(
void
*
),
void
*
arg
,
void
*
stack
);
extern
int
wine_call_on_stack
(
int
(
*
func
)(
void
*
),
void
*
arg
,
void
*
stack
);
extern
void
wine_set_pe_load_area
(
void
*
base
,
size_t
size
);
extern
void
wine_free_pe_load_area
(
void
);
...
...
libs/wine/port.c
View file @
c9f0bea9
...
...
@@ -116,5 +116,69 @@ __ASM_GLOBAL_FUNC( wine_switch_to_stack,
"callq *%rax
\n\t
"
/* call func */
"int $3"
)
#else
void
DECLSPEC_NORETURN
wine_switch_to_stack
(
void
(
*
func
)(
void
*
),
void
*
arg
,
void
*
stack
)
{
wine_call_on_stack
(
(
int
(
*
)(
void
*
))
func
,
arg
,
stack
);
abort
();
}
#endif
/***********************************************************************
* wine_call_on_stack
*
* Switch to the specified stack to call the function and return.
*/
int
wine_call_on_stack
(
int
(
*
func
)(
void
*
),
void
*
arg
,
void
*
stack
);
#if defined(__i386__) && defined(__GNUC__)
__ASM_GLOBAL_FUNC
(
wine_call_on_stack
,
"pushl %ebp
\n\t
"
"pushl %esi
\n\t
"
"movl 12(%esp),%ecx
\n\t
"
/* func */
"movl 16(%esp),%edx
\n\t
"
/* arg */
"movl 20(%esp),%esi
\n\t
"
/* stack */
"andl $~15,%esi
\n\t
"
"subl $12,%esi
\n\t
"
"xchgl %esi,%esp
\n\t
"
"pushl %edx
\n\t
"
"xorl %ebp,%ebp
\n\t
"
"call *%ecx
\n\t
"
"movl %esi,%esp
\n\t
"
"popl %esi
\n\t
"
"popl %ebp
\n\t
"
"ret"
)
#elif defined(__i386__) && defined(_MSC_VER)
__declspec
(
naked
)
int
wine_call_on_stack
(
int
(
*
func
)(
void
*
),
void
*
arg
,
void
*
stack
)
{
__asm
push
ebp
;
__asm
push
esi
;
__asm
mov
ecx
,
12
[
esp
];
__asm
mov
edx
,
16
[
esp
];
__asm
mov
esi
,
20
[
esp
];
__asm
xchg
esp
,
esi
;
__asm
push
edx
;
__asm
xor
ebp
,
ebp
;
__asm
call
[
ecx
];
__asm
mov
esp
,
esi
;
__asm
pop
esi
;
__asm
pop
ebp
__asm
ret
;
}
#elif defined(__x86_64__) && defined(__GNUC__)
__ASM_GLOBAL_FUNC
(
wine_call_on_stack
,
"pushq %rbp
\n\t
"
"pushq %rbx
\n\t
"
"movq %rsp,%rbx
\n\t
"
"movq %rdi,%rax
\n\t
"
/* func */
"movq %rsi,%rdi
\n\t
"
/* arg */
"andq $~15,%rdx
\n\t
"
/* stack */
"movq %rdx,%rsp
\n\t
"
"xorq %rbp,%rbp
\n\t
"
"callq *%rax
\n\t
"
/* call func */
"movq %rbx,%rsp
\n\t
"
"popq %rbx
\n\t
"
"popq %rbp
\n\t
"
"ret"
)
#else
#error You must implement wine_switch_to_stack for your platform
#endif
libs/wine/wine.def
View file @
c9f0bea9
...
...
@@ -50,6 +50,7 @@ EXPORTS
vsnprintfW
vsprintfW
wine_anon_mmap
wine_call_on_stack
wine_casemap_lower
wine_casemap_upper
wine_compare_string
...
...
@@ -65,7 +66,7 @@ EXPORTS
wine_dbgstr_an
wine_dbgstr_wn
wine_dlclose
wine_dll_enum_load_path
;
wine_dll_enum_load_path
wine_dll_get_owner
wine_dll_load
wine_dll_load_main_exe
...
...
libs/wine/wine.map
View file @
c9f0bea9
...
...
@@ -50,6 +50,7 @@ WINE_1.0
vsnprintfW;
vsprintfW;
wine_anon_mmap;
wine_call_on_stack;
wine_casemap_lower;
wine_casemap_upper;
wine_compare_string;
...
...
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