Alexandre Julliard : winecrt0: Add a trampoline function to align the stack on x86_64 before continuing an exception .

Alexandre Julliard julliard at winehq.org
Thu Apr 8 11:12:44 CDT 2010


Module: wine
Branch: master
Commit: 772112cfcb3c496a525238b416eb1ba4b1598c0a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=772112cfcb3c496a525238b416eb1ba4b1598c0a

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Apr  8 16:12:14 2010 +0200

winecrt0: Add a trampoline function to align the stack on x86_64 before continuing an exception.

---

 dlls/winecrt0/exception.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/dlls/winecrt0/exception.c b/dlls/winecrt0/exception.c
index 65b6b41..c81c821 100644
--- a/dlls/winecrt0/exception.c
+++ b/dlls/winecrt0/exception.c
@@ -23,6 +23,12 @@
 #include "winternl.h"
 #include "wine/exception.h"
 
+#if defined(__x86_64__) && defined(__ASM_GLOBAL_FUNC)
+extern void __wine_unwind_trampoline(void);
+/* we need an extra call to make sure the stack is correctly aligned */
+__ASM_GLOBAL_FUNC( __wine_unwind_trampoline, "callq *%rax" );
+#endif
+
 /* wrapper for RtlUnwind since it clobbers registers on Windows */
 void __wine_rtl_unwind( EXCEPTION_REGISTRATION_RECORD* frame, EXCEPTION_RECORD *record,
                         void (*target)(void) )
@@ -41,6 +47,8 @@ void __wine_rtl_unwind( EXCEPTION_REGISTRATION_RECORD* frame, EXCEPTION_RECORD *
                          : "=a" (dummy1), "=S" (dummy2), "=D" (dummy3), "=c" (dummy4)
                          : "0" (RtlUnwind), "1" (frame), "2" (target), "3" (record)
                          : "edx", "memory" );
+#elif defined(__x86_64__) && defined(__ASM_GLOBAL_FUNC)
+    RtlUnwind( frame, __wine_unwind_trampoline, record, target );
 #else
     RtlUnwind( frame, target, record, 0 );
 #endif




More information about the wine-cvs mailing list