diff --git a/dlls/ntdll/signal_arm64.c b/dlls/ntdll/signal_arm64.c index bc06aae5aec..841a4b05d96 100644 --- a/dlls/ntdll/signal_arm64.c +++ b/dlls/ntdll/signal_arm64.c @@ -186,10 +186,7 @@ static NTSTATUS virtual_unwind( ULONG type, DISPATCHER_CONTEXT *dispatch, CONTEX dispatch->ControlPcIsUnwound = (context->ContextFlags & CONTEXT_UNWOUND_TO_CALL) != 0; pc = context->Pc - (dispatch->ControlPcIsUnwound ? 4 : 0); - /* first look for PE exception information */ - - if ((dispatch->FunctionEntry = lookup_function_info(pc, - &dispatch->ImageBase, &module ))) + if ((dispatch->FunctionEntry = lookup_function_info( pc, &dispatch->ImageBase, &module ))) { dispatch->LanguageHandler = RtlVirtualUnwind( type, dispatch->ImageBase, pc, dispatch->FunctionEntry, context, @@ -198,45 +195,18 @@ static NTSTATUS virtual_unwind( ULONG type, DISPATCHER_CONTEXT *dispatch, CONTEX return STATUS_SUCCESS; } - /* then look for host system exception information */ - - if (!module || (module->Flags & LDR_WINE_INTERNAL)) - { - struct unwind_builtin_dll_params params = { type, dispatch, context }; - - status = WINE_UNIX_CALL( unix_unwind_builtin_dll, ¶ms ); - if (status != STATUS_SUCCESS) return status; - - if (dispatch->EstablisherFrame) - { - dispatch->FunctionEntry = NULL; - if (dispatch->LanguageHandler && !module) - { - FIXME( "calling personality routine in system library not supported yet\n" ); - dispatch->LanguageHandler = NULL; - } - return STATUS_SUCCESS; - } - } + status = context->Pc != context->Lr ? STATUS_SUCCESS : STATUS_INVALID_DISPOSITION; + if (module) + WARN( "exception data not found in %s for pc %p, lr %p\n", + debugstr_w(module->BaseDllName.Buffer), (void *)context->Pc, (void *)context->Lr ); else - { - status = context->Pc != context->Lr ? - STATUS_SUCCESS : STATUS_INVALID_DISPOSITION; - WARN( "exception data not found in %s for %p, LR %p, status %lx\n", - debugstr_w(module->BaseDllName.Buffer), (void*) context->Pc, - (void*) context->Lr, status ); - dispatch->EstablisherFrame = context->Sp; - dispatch->LanguageHandler = NULL; - context->Pc = context->Lr; - context->ContextFlags |= CONTEXT_UNWOUND_TO_CALL; - return status; - } - - dispatch->EstablisherFrame = context->Fp; + WARN( "no module found for pc %p, lr %p\n", + (void *)context->Pc, (void *)context->Lr ); + dispatch->EstablisherFrame = context->Sp; dispatch->LanguageHandler = NULL; context->Pc = context->Lr; context->ContextFlags |= CONTEXT_UNWOUND_TO_CALL; - return STATUS_SUCCESS; + return status; } diff --git a/dlls/ntdll/unix/dwarf.h b/dlls/ntdll/unix/dwarf.h index 51102cd4a7e..73beeda51fc 100644 --- a/dlls/ntdll/unix/dwarf.h +++ b/dlls/ntdll/unix/dwarf.h @@ -214,6 +214,8 @@ #define DW_OP_GNU_uninit 0xf0 #define DW_OP_GNU_encoded_addr 0xf1 +#ifndef NTDLL_DWARF_H_NO_UNWINDER + #define DW_EH_PE_native 0x00 #define DW_EH_PE_uleb128 0x01 #define DW_EH_PE_udata2 0x02 @@ -233,8 +235,6 @@ #define DW_EH_PE_indirect 0x80 #define DW_EH_PE_omit 0xff -#ifndef NTDLL_DWARF_H_NO_UNWINDER - struct dwarf_eh_bases { void *tbase; diff --git a/dlls/ntdll/unix/signal_arm64.c b/dlls/ntdll/unix/signal_arm64.c index 62886c74515..a20bfb8eaf3 100644 --- a/dlls/ntdll/unix/signal_arm64.c +++ b/dlls/ntdll/unix/signal_arm64.c @@ -62,6 +62,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(seh); +#define NTDLL_DWARF_H_NO_UNWINDER #include "dwarf.h" /*********************************************************************** @@ -202,131 +203,6 @@ static BOOL is_inside_syscall( ucontext_t *sigcontext ) (char *)SP_sig(sigcontext) <= (char *)arm64_thread_data()->syscall_frame); } -/*********************************************************************** - * dwarf_virtual_unwind - * - * Equivalent of RtlVirtualUnwind for builtin modules. - */ -static NTSTATUS dwarf_virtual_unwind( ULONG64 ip, ULONG64 *frame, CONTEXT *context, - const struct dwarf_fde *fde, const struct dwarf_eh_bases *bases, - PEXCEPTION_ROUTINE *handler, void **handler_data ) -{ - const struct dwarf_cie *cie; - const unsigned char *ptr, *augmentation, *end; - ULONG_PTR len, code_end; - struct frame_info info; - struct frame_state state_stack[MAX_SAVED_STATES]; - int aug_z_format = 0; - unsigned char lsda_encoding = DW_EH_PE_omit; - - memset( &info, 0, sizeof(info) ); - info.state_stack = state_stack; - info.ip = (ULONG_PTR)bases->func; - *handler = NULL; - - cie = (const struct dwarf_cie *)((const char *)&fde->cie_offset - fde->cie_offset); - - /* parse the CIE first */ - - if (cie->version != 1 && cie->version != 3) - { - FIXME( "unknown CIE version %u at %p\n", cie->version, cie ); - return STATUS_INVALID_DISPOSITION; - } - ptr = cie->augmentation + strlen((const char *)cie->augmentation) + 1; - - info.code_align = dwarf_get_uleb128( &ptr ); - info.data_align = dwarf_get_sleb128( &ptr ); - if (cie->version == 1) - info.retaddr_reg = *ptr++; - else - info.retaddr_reg = dwarf_get_uleb128( &ptr ); - info.state.cfa_rule = RULE_CFA_OFFSET; - - TRACE( "function %lx base %p cie %p len %x id %x version %x aug '%s' code_align %lu data_align %ld retaddr %s\n", - ip, bases->func, cie, cie->length, cie->id, cie->version, cie->augmentation, - info.code_align, info.data_align, dwarf_reg_names[info.retaddr_reg] ); - - end = NULL; - for (augmentation = cie->augmentation; *augmentation; augmentation++) - { - switch (*augmentation) - { - case 'z': - len = dwarf_get_uleb128( &ptr ); - end = ptr + len; - aug_z_format = 1; - continue; - case 'L': - lsda_encoding = *ptr++; - continue; - case 'P': - { - unsigned char encoding = *ptr++; - *handler = (void *)dwarf_get_ptr( &ptr, encoding, bases ); - continue; - } - case 'R': - info.fde_encoding = *ptr++; - continue; - case 'S': - info.signal_frame = 1; - continue; - } - FIXME( "unknown augmentation '%c'\n", *augmentation ); - if (!end) return STATUS_INVALID_DISPOSITION; /* cannot continue */ - break; - } - if (end) ptr = end; - - end = (const unsigned char *)(&cie->length + 1) + cie->length; - execute_cfa_instructions( ptr, end, ip, &info, bases ); - - ptr = (const unsigned char *)(fde + 1); - info.ip = dwarf_get_ptr( &ptr, info.fde_encoding, bases ); /* fde code start */ - code_end = info.ip + dwarf_get_ptr( &ptr, info.fde_encoding & 0x0f, bases ); /* fde code length */ - - if (aug_z_format) /* get length of augmentation data */ - { - len = dwarf_get_uleb128( &ptr ); - end = ptr + len; - } - else end = NULL; - - *handler_data = (void *)dwarf_get_ptr( &ptr, lsda_encoding, bases ); - if (end) ptr = end; - - end = (const unsigned char *)(&fde->length + 1) + fde->length; - TRACE( "fde %p len %x personality %p lsda %p code %lx-%lx\n", - fde, fde->length, *handler, *handler_data, info.ip, code_end ); - execute_cfa_instructions( ptr, end, ip, &info, bases ); - *frame = context->Sp; - apply_frame_state( context, &info.state, bases ); - context->ContextFlags |= CONTEXT_UNWOUND_TO_CALL; - /* Set Pc based on Lr; libunwind also does this as part of unw_step. */ - context->Pc = context->Lr; - - TRACE( "next function pc=%016lx\n", context->Pc ); - TRACE(" x0=%016lx x1=%016lx x2=%016lx x3=%016lx\n", - context->X0, context->X1, context->X2, context->X3 ); - TRACE(" x4=%016lx x5=%016lx x6=%016lx x7=%016lx\n", - context->X4, context->X5, context->X6, context->X7 ); - TRACE(" x8=%016lx x9=%016lx x10=%016lx x11=%016lx\n", - context->X8, context->X9, context->X10, context->X11 ); - TRACE(" x12=%016lx x13=%016lx x14=%016lx x15=%016lx\n", - context->X12, context->X13, context->X14, context->X15 ); - TRACE(" x16=%016lx x17=%016lx x18=%016lx x19=%016lx\n", - context->X16, context->X17, context->X18, context->X19 ); - TRACE(" x20=%016lx x21=%016lx x22=%016lx x23=%016lx\n", - context->X20, context->X21, context->X22, context->X23 ); - TRACE(" x24=%016lx x25=%016lx x26=%016lx x27=%016lx\n", - context->X24, context->X25, context->X26, context->X27 ); - TRACE(" x28=%016lx fp=%016lx lr=%016lx sp=%016lx\n", - context->X28, context->Fp, context->Lr, context->Sp ); - - return STATUS_SUCCESS; -} - /*********************************************************************** * unwind_builtin_dll @@ -335,23 +211,7 @@ static NTSTATUS dwarf_virtual_unwind( ULONG64 ip, ULONG64 *frame, CONTEXT *conte */ NTSTATUS unwind_builtin_dll( void *args ) { - struct unwind_builtin_dll_params *params = args; - DISPATCHER_CONTEXT *dispatch = params->dispatch; - CONTEXT *context = params->context; - struct dwarf_eh_bases bases; - const struct dwarf_fde *fde = _Unwind_Find_FDE( (void *)(context->Pc - 1), &bases ); - - if (fde) - return dwarf_virtual_unwind( context->Pc, &dispatch->EstablisherFrame, context, fde, - &bases, &dispatch->LanguageHandler, &dispatch->HandlerData ); - - TRACE( "no info found for %lx, assuming leaf function\n", - context->Pc ); - dispatch->LanguageHandler = NULL; - dispatch->EstablisherFrame = context->Sp; - context->Pc = context->Lr; - context->ContextFlags |= CONTEXT_UNWOUND_TO_CALL; - return STATUS_SUCCESS; + return STATUS_UNSUCCESSFUL; }