From e6fb7d0f0b1380ae4bf94a41cc23cf66e0c1080b Mon Sep 17 00:00:00 2001 From: Ilya Kurdyukov Date: Fri, 13 Aug 2021 17:29:49 +0700 Subject: [PATCH] libpcl-1.12 e2k support --- include/pcl_config.h | 2 +- pcl/pcl.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/pcl_config.h b/include/pcl_config.h index be922c1..0b9f696 100644 --- a/include/pcl_config.h +++ b/include/pcl_config.h @@ -36,7 +36,7 @@ */ #define CO_MULTI_THREAD -#elif defined(HAVE_GETCONTEXT) && defined(HAVE_MAKECONTEXT) && defined(HAVE_SWAPCONTEXT) +#elif defined(HAVE_GETCONTEXT) && (defined(HAVE_MAKECONTEXT) || defined(__e2k__)) && defined(HAVE_SWAPCONTEXT) /* * Use this if the system has a working getcontext/makecontext/swapcontext diff --git a/pcl/pcl.c b/pcl/pcl.c index 58d8605..b07650f 100644 --- a/pcl/pcl.c +++ b/pcl/pcl.c @@ -77,7 +77,12 @@ static int co_set_context(co_ctx_t *ctx, void *func, char *stkbase, long stksiz) ctx->cc.uc_stack.ss_size = stksiz - sizeof(long); ctx->cc.uc_stack.ss_flags = 0; +#ifdef __e2k__ + if (makecontext_e2k(&ctx->cc, func, 1) < 0) + return -1; +#else makecontext(&ctx->cc, func, 1); +#endif return 0; } @@ -416,6 +421,9 @@ void co_delete(coroutine_t coro) tctx->co_curr); exit(1); } +#if defined(CO_USE_UCONEXT) && defined(__e2k__) + freecontext_e2k(&co->ctx.cc); +#endif if (co->alloc) free(co); } -- 2.17.1