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
351bd330
Commit
351bd330
authored
May 14, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winecrt0: Reimplement __wine_rtl_unwind() as a proper asm function.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9177a75a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
26 deletions
+38
-26
exception.c
dlls/winecrt0/exception.c
+37
-25
exception.h
include/wine/exception.h
+1
-1
No files found.
dlls/winecrt0/exception.c
View file @
351bd330
...
@@ -23,38 +23,50 @@
...
@@ -23,38 +23,50 @@
#include "wine/exception.h"
#include "wine/exception.h"
#include "wine/asm.h"
#include "wine/asm.h"
#ifdef __x86_64__
#if defined(__GNUC__) && defined(__i386__)
extern
void
__wine_unwind_trampoline
(
void
);
/* we need an extra call to make sure the stack is correctly aligned */
__ASM_GLOBAL_FUNC
(
__wine_rtl_unwind
,
__ASM_GLOBAL_FUNC
(
__wine_unwind_trampoline
,
"callq *%rax"
);
"pushl %ebp
\n\t
"
#endif
__ASM_CFI
(
".cfi_adjust_cfa_offset 4
\n\t
"
)
__ASM_CFI
(
".cfi_rel_offset %ebp,0
\n\t
"
)
"movl %esp,%ebp
\n\t
"
__ASM_CFI
(
".cfi_def_cfa_register %ebp
\n\t
"
)
"subl $8,%esp
\n\t
"
"pushl $0
\n\t
"
/* retval */
"pushl 12(%ebp)
\n\t
"
/* record */
"pushl 16(%ebp)
\n\t
"
/* target */
"pushl 8(%ebp)
\n\t
"
/* frame */
"call "
__ASM_NAME
(
"RtlUnwind"
)
__ASM_STDCALL
(
16
)
"
\n\t
"
"call *16(%ebp)"
)
#elif defined(__GNUC__) && defined(__x86_64__)
__ASM_GLOBAL_FUNC
(
__wine_rtl_unwind
,
"pushq %rbp
\n\t
"
__ASM_CFI
(
".cfi_adjust_cfa_offset 8
\n\t
"
)
__ASM_CFI
(
".cfi_rel_offset %rbp,0
\n\t
"
)
"movq %rsp,%rbp
\n\t
"
__ASM_CFI
(
".cfi_def_cfa_register %rbp
\n\t
"
)
"subq $0x20,%rsp
\n\t
"
"movq %r8,%r9
\n\t
"
/* retval = final target */
"movq %rdx,%r8
\n\t
"
/* record */
"leaq __wine_unwind_trampoline(%rip),%rdx
\n\t
"
/* target = trampoline */
"call "
__ASM_NAME
(
"RtlUnwind"
)
"
\n
"
"__wine_unwind_trampoline:
\n\t
"
/* we need an extra call to make sure the stack is correctly aligned */
"callq *%rax"
)
#else
/* wrapper for RtlUnwind since it clobbers registers on Windows */
void
__cdecl
__wine_rtl_unwind
(
EXCEPTION_REGISTRATION_RECORD
*
frame
,
EXCEPTION_RECORD
*
record
,
void
__wine_rtl_unwind
(
EXCEPTION_REGISTRATION_RECORD
*
frame
,
EXCEPTION_RECORD
*
record
,
void
(
*
target
)(
void
)
)
void
(
*
target
)(
void
)
)
{
{
#if defined(__GNUC__) && defined(__i386__)
int
dummy1
,
dummy2
,
dummy3
,
dummy4
;
__asm__
__volatile__
(
"pushl %%ebp
\n\t
"
"pushl %%ebx
\n\t
"
"pushl $0
\n\t
"
"pushl %3
\n\t
"
"pushl %2
\n\t
"
"pushl %1
\n\t
"
"call *%0
\n\t
"
"popl %%ebx
\n\t
"
"popl %%ebp"
:
"=a"
(
dummy1
),
"=S"
(
dummy2
),
"=D"
(
dummy3
),
"=c"
(
dummy4
)
:
"0"
(
RtlUnwind
),
"1"
(
frame
),
"2"
(
target
),
"3"
(
record
)
:
"edx"
,
"memory"
);
#elif defined(__x86_64__)
RtlUnwind
(
frame
,
__wine_unwind_trampoline
,
record
,
target
);
#else
RtlUnwind
(
frame
,
target
,
record
,
0
);
RtlUnwind
(
frame
,
target
,
record
,
0
);
#endif
for
(;;)
target
();
for
(;;)
target
();
}
}
#endif
static
void
DECLSPEC_NORETURN
unwind_target
(
void
)
static
void
DECLSPEC_NORETURN
unwind_target
(
void
)
{
{
__WINE_FRAME
*
wine_frame
=
(
__WINE_FRAME
*
)
__wine_get_frame
();
__WINE_FRAME
*
wine_frame
=
(
__WINE_FRAME
*
)
__wine_get_frame
();
...
...
include/wine/exception.h
View file @
351bd330
...
@@ -98,7 +98,7 @@ static inline int sigsetjmp( sigjmp_buf buf, int sigs ) { return setjmp( buf );
...
@@ -98,7 +98,7 @@ static inline int sigsetjmp( sigjmp_buf buf, int sigs ) { return setjmp( buf );
static
inline
void
siglongjmp
(
sigjmp_buf
buf
,
int
val
)
{
longjmp
(
buf
,
val
);
}
static
inline
void
siglongjmp
(
sigjmp_buf
buf
,
int
val
)
{
longjmp
(
buf
,
val
);
}
#endif
#endif
extern
void
__wine_rtl_unwind
(
EXCEPTION_REGISTRATION_RECORD
*
frame
,
EXCEPTION_RECORD
*
record
,
extern
void
__
cdecl
__
wine_rtl_unwind
(
EXCEPTION_REGISTRATION_RECORD
*
frame
,
EXCEPTION_RECORD
*
record
,
void
(
*
target
)(
void
)
)
DECLSPEC_HIDDEN
DECLSPEC_NORETURN
;
void
(
*
target
)(
void
)
)
DECLSPEC_HIDDEN
DECLSPEC_NORETURN
;
extern
DWORD
__wine_exception_handler
(
EXCEPTION_RECORD
*
record
,
extern
DWORD
__wine_exception_handler
(
EXCEPTION_RECORD
*
record
,
EXCEPTION_REGISTRATION_RECORD
*
frame
,
EXCEPTION_REGISTRATION_RECORD
*
frame
,
...
...
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