-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathlibpcl-1.12-e2k.patch
53 lines (46 loc) · 1.4 KB
/
libpcl-1.12-e2k.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From e6fb7d0f0b1380ae4bf94a41cc23cf66e0c1080b Mon Sep 17 00:00:00 2001
From: Ilya Kurdyukov <[email protected]>
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