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
b9fd2c8d
Commit
b9fd2c8d
authored
Jun 16, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libwine: Add unwind annotations to the stack switching functions for x86_64.
parent
4830a291
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
48 deletions
+9
-48
port.c
libs/wine/port.c
+9
-48
No files found.
libs/wine/port.c
View file @
b9fd2c8d
...
...
@@ -53,30 +53,7 @@ void wine_pthread_set_functions( const struct wine_pthread_functions *functions,
*
* Switch to the specified stack and call the function.
*/
void
DECLSPEC_NORETURN
wine_switch_to_stack
(
void
(
*
func
)(
void
*
),
void
*
arg
,
void
*
stack
);
#if defined(__i386__) && defined(__GNUC__)
__ASM_GLOBAL_FUNC
(
wine_switch_to_stack
,
"movl 4(%esp),%ecx
\n\t
"
/* func */
"movl 8(%esp),%edx
\n\t
"
/* arg */
"movl 12(%esp),%esp
\n\t
"
/* stack */
"andl $~15,%esp
\n\t
"
"subl $12,%esp
\n\t
"
"pushl %edx
\n\t
"
"xorl %ebp,%ebp
\n\t
"
"call *%ecx
\n\t
"
"int $3"
/* we never return here */
)
#elif defined(__i386__) && defined(_MSC_VER)
__declspec
(
naked
)
void
wine_switch_to_stack
(
void
(
*
func
)(
void
*
),
void
*
arg
,
void
*
stack
)
{
__asm
mov
ecx
,
4
[
esp
];
__asm
mov
edx
,
8
[
esp
];
__asm
mov
esp
,
12
[
esp
];
__asm
push
edx
;
__asm
xor
ebp
,
ebp
;
__asm
call
[
ecx
];
__asm
int
3
;
}
#elif defined(__sparc__) && defined(__GNUC__)
#if defined(__sparc__) && defined(__GNUC__)
__ASM_GLOBAL_FUNC
(
wine_switch_to_stack
,
"mov %o0, %l0
\n\t
"
/* store first argument */
"mov %o1, %l1
\n\t
"
/* store second argument */
...
...
@@ -92,16 +69,6 @@ __ASM_GLOBAL_FUNC( wine_switch_to_stack,
"subi r1,r1,0x100
\n\t
"
/* adjust stack pointer */
"bctrl
\n
"
/* call ctr */
"1:
\t
b 1b"
)
/* loop */
#elif defined(__powerpc__) && defined(__GNUC__)
__ASM_GLOBAL_FUNC
(
wine_switch_to_stack
,
"mtctr 3
\n\t
"
/* func -> ctr */
"mr 3,4
\n\t
"
/* args -> function param 1 (r3) */
"mr 1,5
\n\t
"
/* stack */
"subi 1, 1, 16
\n\t
"
/* allocate space for the callee */
"li 0, 0
\n\t
"
/* load zero */
"stw 0, 0(1)
\n\t
"
/* create a bottom stack frame */
"bctrl
\n\t
"
/* call ctr */
"1:
\t
b 1b"
)
/* loop */
#elif defined(__ALPHA__) && defined(__GNUC__)
__ASM_GLOBAL_FUNC
(
wine_switch_to_stack
,
"mov $16,$0
\n\t
"
/* func */
...
...
@@ -109,15 +76,6 @@ __ASM_GLOBAL_FUNC( wine_switch_to_stack,
"mov $18,$30
\n\t
"
/* stack */
"jsr $31,($0),0
\n\t
"
/* call func */
"L1:
\t
br $31,L1"
)
/* loop */
#elif defined(__x86_64__) && defined(__GNUC__)
__ASM_GLOBAL_FUNC
(
wine_switch_to_stack
,
"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 */
"int $3"
)
#else
void
DECLSPEC_NORETURN
wine_switch_to_stack
(
void
(
*
func
)(
void
*
),
void
*
arg
,
void
*
stack
)
{
...
...
@@ -170,17 +128,20 @@ __declspec(naked) int wine_call_on_stack( int (*func)(void *), void *arg, void *
#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
"
".cfi_adjust_cfa_offset 8
\n\t
"
".cfi_rel_offset %rbp,0
\n\t
"
"movq %rsp,%rbp
\n\t
"
".cfi_def_cfa_register %rbp
\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 %rb
x
,%rsp
\n\t
"
"
popq %rbx
\n\t
"
"movq %rb
p
,%rsp
\n\t
"
"
.cfi_def_cfa_register %rsp
\n\t
"
"popq %rbp
\n\t
"
".cfi_adjust_cfa_offset -8
\n\t
"
".cfi_same_value %rbp
\n\t
"
"ret"
)
#elif defined(__powerpc__) && defined(__GNUC__)
__ASM_GLOBAL_FUNC
(
wine_call_on_stack
,
...
...
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