+ memcpy (copied_ctx, ctx, sizeof (ucontext_t));
+#ifdef __APPLE__
+ {
+ guint8 * copied_mcontext = (guint8*)copied_ctx + sizeof (ucontext_t);
+ /* uc_mcontext is a pointer, so make a copy which is stored after the ctx */
+ memcpy (copied_mcontext, ctx->uc_mcontext, sizeof (*ctx->uc_mcontext));
+ copied_ctx->uc_mcontext = (void*)copied_mcontext;
+ }
+#endif