ntdll: Properly restore x29/x30 for arm64 packed unwind data with local stack.

For the CR == 3 case, x29/x30 should be restored from x29, not from
sp, which may have been decremented further for local stack storage.

This fixes uwinding the stack for C++ exceptions in code generated
by MSVC.

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Martin Storsjo 2020-05-18 15:16:29 +03:00 committed by Alexandre Julliard
parent 93ecc54ae5
commit 5f14b6357b
1 changed files with 6 additions and 1 deletions

View File

@ -1558,7 +1558,12 @@ static void *unwind_packed_data( ULONG_PTR base, ULONG_PTR pc, RUNTIME_FUNCTION
if (!skip)
{
if (func->u.s.CR == 3) restore_regs( 29, 2, 0, context, ptrs );
if (func->u.s.CR == 3)
{
DWORD64 *fp = (DWORD64 *) context->u.s.Fp; /* u.X[29] */
context->u.X[29] = fp[0];
context->u.X[30] = fp[1];
}
context->Sp += local_size;
if (fp_size) restore_fpregs( 8, fp_size / 8, int_size, context, ptrs );
if (func->u.s.CR == 1) restore_regs( 30, 1, int_size - 8, context, ptrs );