ntdll: Fix arm64 call_user_exception_dispatcher with kernel stack for syscalls.

Don't call KiUserExceptionDispatcher directly on the stack pointer
stored in the CONTEXT, but use the one stored in syscall_frame
(which includes the stack allocation in e.g. RtlRaiseException).

This fixes unwinding test cases that worked before
08c4419a49.

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Martin Storsjo 2021-07-25 23:33:05 +03:00 committed by Alexandre Julliard
parent 0342de8e4d
commit 23b44e8df6
1 changed files with 6 additions and 0 deletions

View File

@ -705,12 +705,18 @@ void call_raise_user_exception_dispatcher(void)
NTSTATUS call_user_exception_dispatcher( EXCEPTION_RECORD *rec, CONTEXT *context )
{
struct syscall_frame *frame = arm64_thread_data()->syscall_frame;
ULONG64 fp = frame->fp;
ULONG64 lr = frame->lr;
ULONG64 sp = frame->sp;
NTSTATUS status = NtSetContextThread( GetCurrentThread(), context );
if (status) return status;
frame->x[0] = (ULONG64)rec;
frame->x[1] = (ULONG64)context;
frame->pc = (ULONG64)pKiUserExceptionDispatcher;
frame->fp = fp;
frame->lr = lr;
frame->sp = sp;
frame->restore_flags |= CONTEXT_INTEGER | CONTEXT_CONTROL;
return status;
}