Commit a8a944c2 authored by Martin Storsjo's avatar Martin Storsjo Committed by Alexandre Julliard

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: 's avatarMartin Storsjo <martin@martin.st> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 6c11d1d7
...@@ -849,14 +849,16 @@ static NTSTATUS call_function_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_con ...@@ -849,14 +849,16 @@ static NTSTATUS call_function_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_con
EXCEPTION_REGISTRATION_RECORD *teb_frame = NtCurrentTeb()->Tib.ExceptionList; EXCEPTION_REGISTRATION_RECORD *teb_frame = NtCurrentTeb()->Tib.ExceptionList;
UNWIND_HISTORY_TABLE table; UNWIND_HISTORY_TABLE table;
DISPATCHER_CONTEXT dispatch; DISPATCHER_CONTEXT dispatch;
CONTEXT context; CONTEXT context, prev_context;
NTSTATUS status; NTSTATUS status;
context = *orig_context; context = *orig_context;
dispatch.TargetPc = 0; dispatch.TargetPc = 0;
dispatch.ContextRecord = &context; dispatch.ContextRecord = &context;
dispatch.HistoryTable = &table; dispatch.HistoryTable = &table;
dispatch.NonVolatileRegisters = (BYTE *)&context.u.s.X19; prev_context = context;
dispatch.NonVolatileRegisters = (BYTE *)&prev_context.u.s.X19;
for (;;) for (;;)
{ {
status = virtual_unwind( UNW_FLAG_EHANDLER, &dispatch, &context ); status = virtual_unwind( UNW_FLAG_EHANDLER, &dispatch, &context );
...@@ -933,6 +935,7 @@ static NTSTATUS call_function_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_con ...@@ -933,6 +935,7 @@ static NTSTATUS call_function_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_con
} }
if (context.Sp == (ULONG64)NtCurrentTeb()->Tib.StackBase) break; if (context.Sp == (ULONG64)NtCurrentTeb()->Tib.StackBase) break;
prev_context = context;
} }
return STATUS_UNHANDLED_EXCEPTION; return STATUS_UNHANDLED_EXCEPTION;
} }
......
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