- ((char *) context->uc.uc_stack.ss_sp) +
- context->uc.uc_stack.ss_size);
-#endif /* HAVE_VALGRIND_VALGRIND_H */
-
- context->argc = argc;
- context->argv = argv;
- context->cleanup_func = cleanup_func;
- context->cleanup_arg = cleanup_arg;
-
- 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 */
+ memcpy(ctx_addr, &context, sizeof(smx_ctx_sysv_t));
+ switch (CTX_ADDR_LEN) {
+ case 1:
+ makecontext(&context->uc, (void (*)())smx_ctx_sysv_wrapper,
+ 1, ctx_addr[0]);
+ break;
+ case 2:
+ makecontext(&context->uc, (void (*)())smx_ctx_sysv_wrapper,
+ 2, ctx_addr[0], ctx_addr[1]);
+ break;
+ default:
+ xbt_die("Ucontexts are not supported on this arch yet (addr len = %zu/%zu = %zu)",
+ sizeof(smx_ctx_sysv_t), sizeof(int), CTX_ADDR_LEN);
+ }
+ } else {
+ sysv_maestro_context = context;