Alexandre Julliard : exception.h: Preserve registers when calling RtlUnwind .

Alexandre Julliard julliard at winehq.org
Thu May 1 06:38:49 CDT 2008


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu May  1 11:07:53 2008 +0200

exception.h: Preserve registers when calling RtlUnwind.

---

 include/wine/exception.h |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/include/wine/exception.h b/include/wine/exception.h
index ad21866..590479c 100644
--- a/include/wine/exception.h
+++ b/include/wine/exception.h
@@ -233,7 +233,26 @@ static inline void DECLSPEC_NORETURN __wine_unwind_frame( EXCEPTION_RECORD *reco
     wine_frame->ExceptionCode   = record->ExceptionCode;
     wine_frame->ExceptionRecord = wine_frame;
 
+#if defined(__GNUC__) && defined(__i386__)
+    {
+        /* RtlUnwind clobbers registers on Windows */
+        int dummy1, dummy2, dummy3;
+        __asm__ __volatile__("pushl %%ebp\n\t"
+                             "pushl %%ebx\n\t"
+                             "pushl $0\n\t"
+                             "pushl %2\n\t"
+                             "pushl $0\n\t"
+                             "pushl %1\n\t"
+                             "call *%0\n\t"
+                             "popl %%ebx\n\t"
+                             "popl %%ebp"
+                             : "=a" (dummy1), "=S" (dummy2), "=D" (dummy3)
+                             : "0" (RtlUnwind), "1" (frame), "2" (record)
+                             : "ecx", "edx", "memory" );
+    }
+#else
     RtlUnwind( frame, 0, record, 0 );
+#endif
     __wine_pop_frame( frame );
     siglongjmp( wine_frame->jmp, 1 );
 }




More information about the wine-cvs mailing list