Commit 9f555cde authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Handle leaf functions in RtlVirtualUnwind on ARM64.

parent 852e2ffc
......@@ -147,33 +147,23 @@ __ASM_GLOBAL_FUNC( RtlCaptureContext,
*/
static NTSTATUS virtual_unwind( ULONG type, DISPATCHER_CONTEXT *dispatch, CONTEXT *context )
{
NTSTATUS status;
DWORD64 pc;
DWORD64 pc = context->Pc;
dispatch->ImageBase = 0;
dispatch->ScopeIndex = 0;
dispatch->EstablisherFrame = 0;
dispatch->ControlPc = context->Pc;
dispatch->ScopeIndex = 0;
dispatch->ControlPc = pc;
dispatch->ControlPcIsUnwound = (context->ContextFlags & CONTEXT_UNWOUND_TO_CALL) != 0;
pc = context->Pc - (dispatch->ControlPcIsUnwound ? 4 : 0);
if (dispatch->ControlPcIsUnwound) pc -= 4;
if ((dispatch->FunctionEntry = RtlLookupFunctionEntry( pc, &dispatch->ImageBase,
dispatch->HistoryTable )))
dispatch->FunctionEntry = RtlLookupFunctionEntry( pc, &dispatch->ImageBase, dispatch->HistoryTable );
dispatch->LanguageHandler = RtlVirtualUnwind( type, dispatch->ImageBase, pc, dispatch->FunctionEntry,
context, &dispatch->HandlerData,
&dispatch->EstablisherFrame, NULL );
if (!context->Pc)
{
dispatch->LanguageHandler = RtlVirtualUnwind( type, dispatch->ImageBase, pc,
dispatch->FunctionEntry, context,
&dispatch->HandlerData, &dispatch->EstablisherFrame,
NULL );
return STATUS_SUCCESS;
WARN( "exception data not found for pc %p, lr %p\n", (void *)pc, (void *)context->Lr );
return STATUS_INVALID_DISPOSITION;
}
WARN( "exception data not found for pc %p, lr %p\n", (void *)context->Pc, (void *)context->Lr );
status = context->Pc != context->Lr ? STATUS_SUCCESS : STATUS_INVALID_DISPOSITION;
dispatch->EstablisherFrame = context->Sp;
dispatch->LanguageHandler = NULL;
context->Pc = context->Lr;
context->ContextFlags |= CONTEXT_UNWOUND_TO_CALL;
return status;
return STATUS_SUCCESS;
}
......@@ -383,7 +373,7 @@ NTSTATUS call_seh_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_context )
break;
case ExceptionNestedException:
rec->ExceptionFlags |= EH_NESTED_CALL;
TRACE_(seh)( "nested exception\n" );
TRACE( "nested exception\n" );
break;
case ExceptionCollidedUnwind: {
ULONG64 frame;
......@@ -414,7 +404,7 @@ NTSTATUS call_seh_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_context )
break;
case ExceptionNestedException:
rec->ExceptionFlags |= EH_NESTED_CALL;
TRACE_(seh)( "nested exception\n" );
TRACE( "nested exception\n" );
break;
case ExceptionCollidedUnwind: {
ULONG64 frame;
......
......@@ -779,12 +779,20 @@ PVOID WINAPI RtlVirtualUnwind( ULONG type, ULONG_PTR base, ULONG_PTR pc,
{
void *handler;
TRACE( "type %lx pc %I64x sp %I64x func %I64x\n", type, pc, context->Sp, base + func->BeginAddress );
TRACE( "type %lx pc %I64x sp %I64x\n", type, pc, context->Sp );
if (!func && pc == context->Lr) /* invalid leaf function */
{
context->Pc = 0;
return NULL;
}
*handler_data = NULL;
context->ContextFlags |= CONTEXT_UNWOUND_TO_CALL;
if (func->Flag)
if (!func) /* leaf function */
handler = NULL;
else if (func->Flag)
handler = unwind_packed_data( base, pc, func, context, ctx_ptr );
else
handler = unwind_full_data( base, pc, func, context, handler_data, ctx_ptr );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment