Martin Storsjo : ntdll: Keep the previous iteration of NonVolatileRegisters in call_function_handlers.

Alexandre Julliard julliard at winehq.org
Thu May 28 17:11:10 CDT 2020


Module: wine
Branch: master
Commit: a8a944c22099194c6458698eadd58f343d69fd22
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=a8a944c22099194c6458698eadd58f343d69fd22

Author: Martin Storsjo <martin at martin.st>
Date:   Thu May 28 11:14:45 2020 +0300

ntdll: Keep the previous iteration of NonVolatileRegisters in call_function_handlers.

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>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 2af1e238ce..e544a1c2a4 100644
--- a/dlls/ntdll/signal_arm64.c
+++ b/dlls/ntdll/signal_arm64.c
@@ -849,14 +849,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 );
@@ -933,6 +935,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;
 }




More information about the wine-cvs mailing list