From 107b289a4e8fc8f6663450f92b7d2265ba4ff661 Mon Sep 17 00:00:00 2001
From: Alexandre Julliard <julliard@winehq.org>
Date: Thu, 20 Sep 2001 19:33:37 +0000
Subject: [PATCH] Fixed a couple of bugs in _except_handler3.

---
 dlls/msvcrt/except.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/dlls/msvcrt/except.c b/dlls/msvcrt/except.c
index bbbb1019119..c208ccae175 100644
--- a/dlls/msvcrt/except.c
+++ b/dlls/msvcrt/except.c
@@ -38,13 +38,15 @@ typedef struct _MSVCRT_EXCEPTION_FRAME
   PEXCEPTION_POINTERS xpointers;
 } MSVCRT_EXCEPTION_FRAME;
 
-#define TRYLEVEL_END 0xff /* End of trylevel list */
+#define TRYLEVEL_END 0xffffffff /* End of trylevel list */
 
 #if defined(__GNUC__) && defined(__i386__)
 
-#define CALL_FINALLY_BLOCK(code_block, base_ptr) \
-  __asm__ __volatile__ ("movl %0,%%eax; movl %1,%%ebp; call *%%eax" \
-                        : : "g" (code_block), "g" (base_ptr))
+inline static void call_finally_block( void *code_block, void *base_ptr )
+{
+    __asm__ __volatile__ ("movl %1,%%ebp; call *%%eax" \
+                          : : "a" (code_block), "g" (base_ptr));
+}
 
 static DWORD MSVCRT_nested_handler(PEXCEPTION_RECORD rec,
                                    struct __EXCEPTION_FRAME* frame,
@@ -201,7 +203,7 @@ int _except_handler3(PEXCEPTION_RECORD rec,
            */
           frame->trylevel = pScopeTable->previousTryLevel;
           TRACE("__finally block %p\n",pScopeTable[trylevel].lpfnHandler);
-          CALL_FINALLY_BLOCK(pScopeTable[trylevel].lpfnHandler, frame->_ebp);
+          call_finally_block(pScopeTable[trylevel].lpfnHandler, &frame->_ebp);
           ERR("Returned from __finally block - expect crash!\n");
        }
       }
-- 
GitLab