From b96d15e1b0914002dc37d55fcd35e2de4094d4ec Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 21 Aug 2019 11:28:52 +0200 Subject: [PATCH] ntdll: Add .seh annotations for x86_64. Signed-off-by: Alexandre Julliard --- dlls/ntdll/relay.c | 5 ++++- dlls/ntdll/signal_x86_64.c | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/relay.c b/dlls/ntdll/relay.c index 1deb2b7bf28..04957acf7b6 100644 --- a/dlls/ntdll/relay.c +++ b/dlls/ntdll/relay.c @@ -777,9 +777,12 @@ DECLSPEC_HIDDEN void WINAPI relay_trace_exit( struct relay_descr *descr, unsigne extern INT_PTR WINAPI relay_call( struct relay_descr *descr, unsigned int idx, const INT_PTR *stack ); __ASM_GLOBAL_FUNC( relay_call, "pushq %rbp\n\t" + __ASM_SEH(".seh_pushreg %rbp\n\t") __ASM_CFI(".cfi_adjust_cfa_offset 8\n\t") __ASM_CFI(".cfi_rel_offset %rbp,0\n\t") "movq %rsp,%rbp\n\t" + __ASM_SEH(".seh_setframe %rbp,0\n\t") + __ASM_SEH(".seh_endprologue\n\t") __ASM_CFI(".cfi_def_cfa_register %rbp\n\t") "leaq -0x48(%rbp),%rsp\n\t" "andq $~15,%rsp\n\t" @@ -831,7 +834,7 @@ __ASM_GLOBAL_FUNC( relay_call, __ASM_CFI(".cfi_same_value %rsi\n\t") "movq -8(%rbp),%rdi\n\t" __ASM_CFI(".cfi_same_value %rdi\n\t") - "movq %rbp,%rsp\n\t" + "leaq 0(%rbp),%rsp\n\t" __ASM_CFI(".cfi_def_cfa_register %rsp\n\t") "popq %rbp\n\t" __ASM_CFI(".cfi_adjust_cfa_offset -8\n\t") diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c index 2c26bd5604a..bf30815bf00 100644 --- a/dlls/ntdll/signal_x86_64.c +++ b/dlls/ntdll/signal_x86_64.c @@ -1797,6 +1797,8 @@ __ASM_GLOBAL_FUNC( RtlCaptureContext, extern void set_full_cpu_context( const CONTEXT *context ); __ASM_GLOBAL_FUNC( set_full_cpu_context, "subq $40,%rsp\n\t" + __ASM_SEH(".seh_stackalloc 0x40\n\t") + __ASM_SEH(".seh_endprologue\n\t") __ASM_CFI(".cfi_adjust_cfa_offset 40\n\t") "ldmxcsr 0x34(%rdi)\n\t" /* context->MxCsr */ "movw 0x38(%rdi),%ax\n\t" /* context->SegCs */ @@ -3733,11 +3735,15 @@ extern void * WINAPI call_consolidate_callback( CONTEXT *context, EXCEPTION_RECORD *rec ); __ASM_GLOBAL_FUNC( call_consolidate_callback, "pushq %rbp\n\t" + __ASM_SEH(".seh_pushreg %rbp\n\t") __ASM_CFI(".cfi_adjust_cfa_offset 8\n\t") __ASM_CFI(".cfi_rel_offset %rbp,0\n\t") "movq %rsp,%rbp\n\t" + __ASM_SEH(".seh_setframe %rbp,0\n\t") __ASM_CFI(".cfi_def_cfa_register %rbp\n\t") "subq $0x20,%rsp\n\t" + __ASM_SEH(".seh_stackalloc 0x20\n\t") + __ASM_SEH(".seh_endprologue\n\t") "movq %rcx,0x10(%rbp)\n\t" __ASM_CFI(".cfi_remember_state\n\t") __ASM_CFI(".cfi_escape 0x0f,0x07,0x76,0x10,0x06,0x23,0x98,0x01,0x06\n\t") /* CFA */ @@ -3763,7 +3769,7 @@ __ASM_GLOBAL_FUNC( call_consolidate_callback, "movq %r8,%rcx\n\t" "callq *%rdx\n\t" __ASM_CFI(".cfi_restore_state\n\t") - "movq %rbp,%rsp\n\t" + "leaq 0(%rbp),%rsp\n\t" __ASM_CFI(".cfi_def_cfa_register %rsp\n\t") "popq %rbp\n\t" __ASM_CFI(".cfi_adjust_cfa_offset -8\n\t") @@ -4110,9 +4116,11 @@ EXCEPTION_DISPOSITION WINAPI __C_specific_handler( EXCEPTION_RECORD *rec, * RtlRaiseException (NTDLL.@) */ __ASM_GLOBAL_FUNC( RtlRaiseException, - "movq %rcx,8(%rsp)\n\t" "sub $0x4f8,%rsp\n\t" + __ASM_SEH(".seh_stackalloc 0x4f8\n\t") + __ASM_SEH(".seh_endprologue\n\t") __ASM_CFI(".cfi_adjust_cfa_offset 0x4f8\n\t") + "movq %rcx,0x500(%rsp)\n\t" "leaq 0x20(%rsp),%rcx\n\t" "call " __ASM_NAME("RtlCaptureContext") "\n\t" "leaq 0x20(%rsp),%rdx\n\t" /* context pointer */ @@ -4269,6 +4277,8 @@ extern void DECLSPEC_NORETURN start_thread( LPTHREAD_START_ROUTINE entry, void * void *relay ); __ASM_GLOBAL_FUNC( start_thread, "subq $56,%rsp\n\t" + __ASM_SEH(".seh_stackalloc 56\n\t") + __ASM_SEH(".seh_endprologue\n\t") __ASM_CFI(".cfi_adjust_cfa_offset 56\n\t") "movq %rbp,48(%rsp)\n\t" __ASM_CFI(".cfi_rel_offset %rbp,48\n\t")