[libunwind] [libunwind] [SEH] Set NonVolatileRegisters before calling a personality function (PR #137951)

Jacek Caban via cfe-commits cfe-commits at lists.llvm.org
Sun May 4 15:29:00 PDT 2025


================
@@ -212,6 +238,21 @@ __libunwind_seh_personality(int version, _Unwind_Action state,
   ms_exc.ExceptionInformation[2] = state;
   DISPATCHER_CONTEXT *disp_ctx =
       __unw_seh_get_disp_ctx((unw_cursor_t *)context);
+#if defined(__aarch64__)
+  LOCAL_DISPATCHER_CONTEXT_NONVOLREG_ARM64 nonvol;
+  memcpy(&nonvol.GpNvRegs, &disp_ctx->ContextRecord->X19,
+         sizeof(nonvol.GpNvRegs));
+  for (int i = 0; i < 8; i++)
+    nonvol.FpNvRegs[i] = disp_ctx->ContextRecord->V[i + 8].D[0];
+  disp_ctx->NonVolatileRegisters = (PBYTE)&nonvol;
----------------
cjacek wrote:

You could avoid the cast by using `nonvol.Buffer` here.

https://github.com/llvm/llvm-project/pull/137951


More information about the cfe-commits mailing list