Since recently, unwinding never should need to look at the unix libs any longer, and as aarch64 requires PE builds, there should be no need to unwind through any .dll.so files any longer.
Remove assembly unwind opcodes in the aarch64 unixlib.
These no longer are needed, as none of the code in unix libraries is being unwound any more.
We could probably remove all the `__ASM_CFI` from all the other `unix/signal_*.c` files, but I kept this limited to aarch64 for now.
-- v2: https://gitlab.winehq.org/wine/wine/-/merge_requests/4937
From: Martin Storsjö martin@martin.st
Since recently, unwinding never should need to look at the unix libs any longer, and as aarch64 requires PE builds, there should be no need to unwind through any .dll.so files any longer.
Signed-off-by: Martin Storsjö martin@martin.st --- dlls/ntdll/unix/signal_arm64.c | 145 +-------------------------------- 1 file changed, 2 insertions(+), 143 deletions(-)
diff --git a/dlls/ntdll/unix/signal_arm64.c b/dlls/ntdll/unix/signal_arm64.c index 62886c74515..e9482e6f69c 100644 --- a/dlls/ntdll/unix/signal_arm64.c +++ b/dlls/ntdll/unix/signal_arm64.c @@ -202,132 +202,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 +209,8 @@ 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; + ERR("unwinding of builtin dlls not supported\n"); + return STATUS_INVALID_DISPOSITION; }