Alexandre Julliard : libwine: Add call frame annotations in x86 assembly code.

Alexandre Julliard julliard at winehq.org
Thu Jun 25 08:13:57 CDT 2009


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Jun 25 11:54:02 2009 +0200

libwine: Add call frame annotations in x86 assembly code.

---

 libs/port/interlocked.c |    8 ++++++++
 libs/wine/port.c        |   18 ++++++++++++++----
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/libs/port/interlocked.c b/libs/port/interlocked.c
index fc40fe5..cefbb5e 100644
--- a/libs/port/interlocked.c
+++ b/libs/port/interlocked.c
@@ -40,7 +40,11 @@ __ASM_GLOBAL_FUNC(interlocked_cmpxchg_ptr,
                   "ret")
  __ASM_GLOBAL_FUNC(interlocked_cmpxchg64,
                    "push %ebx\n\t"
+                   __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
+                   __ASM_CFI(".cfi_rel_offset %ebx,0\n\t")
                    "push %esi\n\t"
+                   __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
+                   __ASM_CFI(".cfi_rel_offset %esi,0\n\t")
                    "movl 12(%esp),%esi\n\t"
                    "movl 16(%esp),%ebx\n\t"
                    "movl 20(%esp),%ecx\n\t"
@@ -48,7 +52,11 @@ __ASM_GLOBAL_FUNC(interlocked_cmpxchg_ptr,
                    "movl 28(%esp),%edx\n\t"
                    "lock; cmpxchg8b (%esi)\n\t"
                    "pop %esi\n\t"
+                   __ASM_CFI(".cfi_same_value %esi\n\t")
+                   __ASM_CFI(".cfi_adjust_cfa_offset -4\n\t")
                    "pop %ebx\n\t"
+                   __ASM_CFI(".cfi_same_value %ebx\n\t")
+                   __ASM_CFI(".cfi_adjust_cfa_offset -4\n\t")
                    "ret")
 __ASM_GLOBAL_FUNC(interlocked_xchg,
                   "movl 8(%esp),%eax\n\t"
diff --git a/libs/wine/port.c b/libs/wine/port.c
index 6307069..cfd3bcd 100644
--- a/libs/wine/port.c
+++ b/libs/wine/port.c
@@ -94,19 +94,29 @@ void DECLSPEC_NORETURN wine_switch_to_stack( void (*func)(void *), void *arg, vo
 #if defined(__i386__) && defined(__GNUC__)
 __ASM_GLOBAL_FUNC( wine_call_on_stack,
                    "pushl %ebp\n\t"
+                   __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
+                   __ASM_CFI(".cfi_rel_offset %ebp,0\n\t")
                    "pushl %esi\n\t"
+                   __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
+                   __ASM_CFI(".cfi_rel_offset %esi,0\n\t")
+                   "movl %esp,%esi\n\t"
+                   __ASM_CFI(".cfi_def_cfa_register %esi\n\t")
                    "movl 12(%esp),%ecx\n\t"  /* func */
                    "movl 16(%esp),%edx\n\t"  /* arg */
-                   "movl 20(%esp),%esi\n\t"  /* stack */
-                   "andl $~15,%esi\n\t"
-                   "subl $12,%esi\n\t"
-                   "xchgl %esi,%esp\n\t"
+                   "movl 20(%esp),%eax\n\t"  /* stack */
+                   "andl $~15,%eax\n\t"
+                   "subl $12,%eax\n\t"
+                   "movl %eax,%esp\n\t"
                    "pushl %edx\n\t"
                    "xorl %ebp,%ebp\n\t"
                    "call *%ecx\n\t"
                    "movl %esi,%esp\n\t"
                    "popl %esi\n\t"
+                   __ASM_CFI(".cfi_adjust_cfa_offset -4\n\t")
+                   __ASM_CFI(".cfi_same_value %esi\n\t")
                    "popl %ebp\n\t"
+                   __ASM_CFI(".cfi_def_cfa %esp,4\n\t")
+                   __ASM_CFI(".cfi_same_value %ebp\n\t")
                    "ret" )
 #elif defined(__i386__) && defined(_MSC_VER)
 __declspec(naked) int wine_call_on_stack( int (*func)(void *), void *arg, void *stack )




More information about the wine-cvs mailing list