- ((char *) context->uc.uc_stack.ss_sp) +
- context->uc.uc_stack.ss_size);
-#endif /* HAVE_VALGRIND_VALGRIND_H */
-
- makecontext(&((smx_ctx_sysv_t)context)->uc, smx_ctx_sysv_wrapper, 0);
+ ((char *) context->uc.uc_stack.ss_sp) +
+ context->uc.uc_stack.ss_size);
+#endif /* HAVE_VALGRIND_VALGRIND_H */
+ ctx_addr = (uintptr_t)context;
+ makecontext(&((smx_ctx_sysv_t) context)->uc, (void (*)())smx_ctx_sysv_wrapper,
+ SIZEOF_VOIDP / SIZEOF_INT + 1, SIZEOF_VOIDP / SIZEOF_INT,
+#if (SIZEOF_VOIDP == SIZEOF_INT)
+ (int)ctx_addr
+#elif (SIZEOF_VOIDP == 2 * SIZEOF_INT)
+ (int)(ctx_addr >> (8 * sizeof(int))),
+ (int)(ctx_addr)
+#else
+#error Your architecture is not supported yet
+#endif
+ );
+ }else{
+ maestro_context = context;