[PATCH 09/11] ntdll: arm64: Keep the previous iteration of NonVolatileRegisters in call_function_handlers
Martin Storsjo
martin at martin.st
Thu May 28 03:14:45 CDT 2020
Some language specific handlers, called by call_handler, can use
the NonVolatileRegisters to restore the context before running
code, and that assumes that NonVolatileRegisters contains the frame
pointer as it was within the function (before unwinding).
Signed-off-by: Martin Storsjo <martin at martin.st>
---
dlls/ntdll/signal_arm64.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/signal_arm64.c b/dlls/ntdll/signal_arm64.c
index d7d963ced2d..88492755bec 100644
--- a/dlls/ntdll/signal_arm64.c
+++ b/dlls/ntdll/signal_arm64.c
@@ -847,14 +847,16 @@ static NTSTATUS call_function_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_con
EXCEPTION_REGISTRATION_RECORD *teb_frame = NtCurrentTeb()->Tib.ExceptionList;
UNWIND_HISTORY_TABLE table;
DISPATCHER_CONTEXT dispatch;
- CONTEXT context;
+ CONTEXT context, prev_context;
NTSTATUS status;
context = *orig_context;
dispatch.TargetPc = 0;
dispatch.ContextRecord = &context;
dispatch.HistoryTable = &table;
- dispatch.NonVolatileRegisters = (BYTE *)&context.u.s.X19;
+ prev_context = context;
+ dispatch.NonVolatileRegisters = (BYTE *)&prev_context.u.s.X19;
+
for (;;)
{
status = virtual_unwind( UNW_FLAG_EHANDLER, &dispatch, &context );
@@ -931,6 +933,7 @@ static NTSTATUS call_function_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_con
}
if (context.Sp == (ULONG64)NtCurrentTeb()->Tib.StackBase) break;
+ prev_context = context;
}
return STATUS_UNHANDLED_EXCEPTION;
}
--
2.17.1
More information about the wine-devel
mailing list