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

Alexandre Julliard julliard at winehq.org
Mon May 18 15:00:14 CDT 2020


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

Author: Martin Storsjo <martin at martin.st>
Date:   Mon May 18 15:16:29 2020 +0300

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

---

 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 e81ea8f82e..4c5944759f 100644
--- a/dlls/ntdll/signal_arm64.c
+++ b/dlls/ntdll/signal_arm64.c
@@ -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 );




More information about the wine-cvs mailing list