X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/644f1639a5204ebc854c369f3f29a02cd766196b..cb5c0fb6bd81952456a54789b6ad1d570067ae80:/src/kernel/context/ContextBoost.cpp diff --git a/src/kernel/context/ContextBoost.cpp b/src/kernel/context/ContextBoost.cpp index 71274dbadd..759837a4e1 100644 --- a/src/kernel/context/ContextBoost.cpp +++ b/src/kernel/context/ContextBoost.cpp @@ -28,17 +28,11 @@ BoostContext::BoostContext(std::function&& code, actor::ActorImpl* actor /* if the user provided a function for the process then use it, otherwise it is the context for maestro */ if (has_code()) { - /* We need to pass the bottom of the stack to make_fcontext, - depending on the stack direction it may be the lower or higher address: */ -#if PTH_STACKGROWTH == -1 - unsigned char* stack = get_stack() + smx_context_stack_size; -#else - unsigned char* stack = get_stack(); -#endif #if BOOST_VERSION < 106100 - this->fc_ = boost::context::make_fcontext(stack, smx_context_stack_size, BoostContext::wrapper); + this->fc_ = boost::context::make_fcontext(get_stack_bottom(), smx_context_stack_size, BoostContext::wrapper); #else - this->fc_ = boost::context::detail::make_fcontext(stack, smx_context_stack_size, BoostContext::wrapper); + this->fc_ = + boost::context::detail::make_fcontext(get_stack_bottom(), smx_context_stack_size, BoostContext::wrapper); #endif } } @@ -49,7 +43,7 @@ void BoostContext::wrapper(BoostContext::arg_type arg) BoostContext* context = reinterpret_cast(arg); #else BoostContext* context = static_cast(arg.data)[1]; - ASAN_ONLY(xbt_assert(context->asan_ctx_ == static_cast(arg.data)[0])); + context->verify_previous_context(static_cast(arg.data)[0]); ASAN_FINISH_SWITCH(nullptr, &context->asan_ctx_->asan_stack_, &context->asan_ctx_->asan_stack_size_); static_cast(arg.data)[0]->fc_ = arg.fctx; #endif @@ -64,6 +58,7 @@ void BoostContext::wrapper(BoostContext::arg_type arg) } ASAN_ONLY(context->asan_stop_ = true); context->suspend(); + THROW_IMPOSSIBLE; } void BoostContext::swap_into(SwappedContext* to_) @@ -77,7 +72,7 @@ void BoostContext::swap_into(SwappedContext* to_) ASAN_ONLY(to->asan_ctx_ = this); ASAN_START_SWITCH(this->asan_stop_ ? nullptr : &fake_stack, to->asan_stack_, to->asan_stack_size_); boost::context::detail::transfer_t arg = boost::context::detail::jump_fcontext(to->fc_, ctx); - ASAN_ONLY(xbt_assert(this->asan_ctx_ == static_cast(arg.data)[0])); + this->verify_previous_context(static_cast(arg.data)[0]); ASAN_FINISH_SWITCH(fake_stack, &this->asan_ctx_->asan_stack_, &this->asan_ctx_->asan_stack_size_); static_cast(arg.data)[0]->fc_ = arg.fctx; #endif