Zebediah Figura : msvcrt: Avoid using inline assembly in __ExceptionPtrCopyException() and copy_exception().

Alexandre Julliard julliard at winehq.org
Fri Jun 1 18:19:54 CDT 2018


Module: wine
Branch: master
Commit: 0c216b8ca88cfe1b4c116867acd00c0978aa15c0
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=0c216b8ca88cfe1b4c116867acd00c0978aa15c0

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Fri Jun  1 12:03:22 2018 -0500

msvcrt: Avoid using inline assembly in __ExceptionPtrCopyException() and copy_exception().

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcrt/cpp.c         | 12 +-----------
 dlls/msvcrt/except_i386.c | 27 ++++++++++++++++-----------
 2 files changed, 17 insertions(+), 22 deletions(-)

diff --git a/dlls/msvcrt/cpp.c b/dlls/msvcrt/cpp.c
index 3402d13..4857d29 100644
--- a/dlls/msvcrt/cpp.c
+++ b/dlls/msvcrt/cpp.c
@@ -1820,17 +1820,7 @@ void __cdecl __ExceptionPtrRethrow(const exception_ptr *ep)
 #if _MSVCR_VER >= 100
 
 #ifdef __i386__
-static inline void call_copy_ctor( void *func, void *this, void *src, int has_vbase )
-{
-    TRACE( "calling copy ctor %p object %p src %p\n", func, this, src );
-    if (has_vbase)
-        /* in that case copy ctor takes an extra bool indicating whether to copy the base class */
-        __asm__ __volatile__("pushl $1; pushl %2; call *%0"
-                             : : "m" (func), "c" (this), "m" (src) : "eax", "edx", "memory" );
-    else
-        __asm__ __volatile__("pushl %2; call *%0"
-                             : : "m" (func), "c" (this), "m" (src) : "eax", "edx", "memory" );
-}
+extern void call_copy_ctor( void *func, void *this, void *src, int has_vbase );
 #else
 static inline void call_copy_ctor( void *func, void *this, void *src, int has_vbase )
 {
diff --git a/dlls/msvcrt/except_i386.c b/dlls/msvcrt/except_i386.c
index 5121301..ee12fb6 100644
--- a/dlls/msvcrt/except_i386.c
+++ b/dlls/msvcrt/except_i386.c
@@ -154,17 +154,22 @@ static inline void *call_ebp_func( void *func, void *ebp )
 }
 
 /* call a copy constructor */
-static inline void call_copy_ctor( void *func, void *this, void *src, int has_vbase )
-{
-    TRACE( "calling copy ctor %p object %p src %p\n", func, this, src );
-    if (has_vbase)
-        /* in that case copy ctor takes an extra bool indicating whether to copy the base class */
-        __asm__ __volatile__("pushl $1; pushl %2; call *%0"
-                             : : "r" (func), "c" (this), "r" (src) : "eax", "edx", "memory" );
-    else
-        __asm__ __volatile__("pushl %2; call *%0"
-                             : : "r" (func), "c" (this), "r" (src) : "eax", "edx", "memory" );
-}
+extern void call_copy_ctor( void *func, void *this, void *src, int has_vbase );
+
+__ASM_GLOBAL_FUNC( call_copy_ctor,
+                   "pushl %ebp\n\t"
+                   __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")
+                   "pushl $1\n\t"
+                   "movl 12(%ebp), %ecx\n\t"
+                   "pushl 16(%ebp)\n\t"
+                   "call *8(%ebp)\n\t"
+                   "leave\n"
+                   __ASM_CFI(".cfi_def_cfa %esp,4\n\t")
+                   __ASM_CFI(".cfi_same_value %ebp\n\t")
+                   "ret" );
 
 /* continue execution to the specified address after exception is caught */
 static inline void DECLSPEC_NORETURN continue_after_catch( cxx_exception_frame* frame, void *addr )




More information about the wine-cvs mailing list