[PATCH 3/3] ntdll: Properly restore x29/x30 for arm64 packed unwind data with local stack
Martin Storsjo
martin at martin.st
Mon May 18 07:16:29 CDT 2020
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 at martin.st>
---
dlls/ntdll/signal_arm64.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/signal_arm64.c b/dlls/ntdll/signal_arm64.c
index 8227d10fbb..8fb67f42d5 100644
--- a/dlls/ntdll/signal_arm64.c
+++ b/dlls/ntdll/signal_arm64.c
@@ -1585,7 +1585,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 );
--
2.17.1
More information about the wine-devel
mailing list