From 0cb406ef290f46ba0060d609a2b1024c28cf1352 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 25 Jun 2009 11:50:42 +0200 Subject: [PATCH] msvcrt: Add call frame annotations in x86 assembly code. --- dlls/msvcrt/cppexcept.c | 8 ++++++++ dlls/msvcrt/except.c | 5 +++++ dlls/msvcrt/misc.c | 5 +++++ 3 files changed, 18 insertions(+) diff --git a/dlls/msvcrt/cppexcept.c b/dlls/msvcrt/cppexcept.c index 6dafc9e8dc0..a777025f69f 100644 --- a/dlls/msvcrt/cppexcept.c +++ b/dlls/msvcrt/cppexcept.c @@ -413,14 +413,22 @@ extern DWORD CDECL __CxxFrameHandler( PEXCEPTION_RECORD rec, EXCEPTION_REGISTRAT PCONTEXT context, EXCEPTION_REGISTRATION_RECORD** dispatch ); __ASM_GLOBAL_FUNC( __CxxFrameHandler, "pushl $0\n\t" /* nested_trylevel */ + __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") "pushl $0\n\t" /* nested_frame */ + __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") "pushl %eax\n\t" /* descr */ + __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") "pushl 28(%esp)\n\t" /* dispatch */ + __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") "pushl 28(%esp)\n\t" /* context */ + __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") "pushl 28(%esp)\n\t" /* frame */ + __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") "pushl 28(%esp)\n\t" /* rec */ + __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") "call " __ASM_NAME("cxx_frame_handler") "\n\t" "add $28,%esp\n\t" + __ASM_CFI(".cfi_adjust_cfa_offset -28\n\t") "ret" ) diff --git a/dlls/msvcrt/except.c b/dlls/msvcrt/except.c index 9b254f858a7..5de42db376c 100644 --- a/dlls/msvcrt/except.c +++ b/dlls/msvcrt/except.c @@ -117,14 +117,19 @@ static DWORD MSVCRT_nested_handler(PEXCEPTION_RECORD rec, /* Provided for VC++ binary compatibility only */ __ASM_GLOBAL_FUNC(_EH_prolog, + __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") /* skip ret addr */ "pushl $-1\n\t" + __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") "pushl %eax\n\t" + __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") "pushl %fs:0\n\t" + __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") "movl %esp, %fs:0\n\t" "movl 12(%esp), %eax\n\t" "movl %ebp, 12(%esp)\n\t" "leal 12(%esp), %ebp\n\t" "pushl %eax\n\t" + __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") "ret") static void msvcrt_local_unwind2(MSVCRT_EXCEPTION_FRAME* frame, int trylevel, void *ebp) diff --git a/dlls/msvcrt/misc.c b/dlls/msvcrt/misc.c index 3d3c03b9de5..082c38bacc4 100644 --- a/dlls/msvcrt/misc.c +++ b/dlls/msvcrt/misc.c @@ -138,7 +138,10 @@ __ASM_GLOBAL_FUNC(_chkesp, "jnz 1f\n\t" "ret\n" "1:\tpushl %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") "subl $12,%esp\n\t" "pushl %eax\n\t" "pushl %ecx\n\t" @@ -148,6 +151,8 @@ __ASM_GLOBAL_FUNC(_chkesp, "popl %ecx\n\t" "popl %eax\n\t" "leave\n\t" + __ASM_CFI(".cfi_def_cfa %esp,4\n\t") + __ASM_CFI(".cfi_same_value %ebp\n\t") "ret") void CDECL MSVCRT_chkesp_fail(void)