-// The name of this function is currently hardcoded in the code (as string).
-// Do not change it without fixing those references as well.
-void UContext::smx_ctx_sysv_wrapper(int i1, int i2)
-{
- // Rebuild the Context* pointer from the integers:
- int ctx_addr[CTX_ADDR_LEN] = {i1, i2};
- simgrid::kernel::context::UContext* context;
- memcpy(&context, ctx_addr, sizeof context);
-
- ASAN_FINISH_SWITCH(nullptr, &context->asan_ctx_->asan_stack_, &context->asan_ctx_->asan_stack_size_);
- try {
- (*context)();
- } catch (simgrid::kernel::context::Context::StopRequest const&) {
- XBT_DEBUG("Caught a StopRequest");
- } catch (simgrid::Exception const& e) {
- XBT_INFO("Actor killed by an uncatched exception %s", simgrid::xbt::demangle(typeid(e).name()).get());
- throw;
- }
- context->Context::stop();
- ASAN_ONLY(context->asan_stop_ = true);
- context->suspend();
-}
-
-/** A better makecontext
- *
- * Makecontext expects integer arguments, we the context variable is decomposed into a serie of integers and each
- * integer is passed as argument to makecontext.
- */
-void UContext::make_ctx(ucontext_t* ucp, void (*func)(int, int), UContext* arg)
-{
- int ctx_addr[CTX_ADDR_LEN]{};
- memcpy(ctx_addr, &arg, sizeof arg);
- makecontext(ucp, (void (*)())func, 2, ctx_addr[0], ctx_addr[1]);
-}
-