libucontext: Update to latest upstream version 1.3.1

Signed-off-by: Volker Christian <me@vchrist.at>
This commit is contained in:
Volker Christian 2024-08-12 13:38:53 +02:00 committed by Tianling Shen
parent 7c09bbe1bd
commit ee32f403aa
4 changed files with 16 additions and 143 deletions

View File

@ -1,17 +1,18 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=libucontext
PKG_VERSION:=1.2
PKG_VERSION:=1.3.1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/kaniini/libucontext/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=2657e087c493263e7bbbde152a5bc08ce22dc5a7970887ac4fd251b90b58401f
PKG_SOURCE_URL:=https://codeload.github.com/kaniini/libucontext/tar.gz/$(PKG_NAME)-$(PKG_VERSION)?
PKG_HASH:=1243ee9f03ad38e624f6844427b7bc1f0a05aa5de70f15f3b03805a364b971d6
PKG_MAINTAINER:=Volker Christian <me@vchrist.at>
PKG_LICENSE:=ISC
PKG_LICENSE_FILES:=LICENSE
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_FLAGS:=no-mips16
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
@ -36,7 +37,7 @@ define Package/libucontext-tests
endef
define Package/libucontext/description
Thie package is a development package aimed to be linked to
This package is a development package aimed to be linked to
libraries/applications which need the SYS-V ucontext API.
endef

View File

@ -1,17 +0,0 @@
--- a/arch/arm/swapcontext.S
+++ b/arch/arm/swapcontext.S
@@ -17,10 +17,12 @@ ALIAS(__swapcontext, libucontext_swapcon
FUNC(libucontext_swapcontext)
/* copy all of the current registers into the ucontext structure */
- add r2, r0, #REG_OFFSET(0)
- stmia r2, {r0-r12}
str r13, [r0,#REG_OFFSET(13)]
str r14, [r0,#REG_OFFSET(15)]
+ add r2, r0, #REG_OFFSET(0)
+ /* copy r0 with value 0 to indicate success (return value 0) */
+ mov r0, #0
+ stmia r2, {r0-r12}
/* load new registers from the second ucontext structure */
add r14, r1, #REG_OFFSET(0)

View File

@ -0,0 +1,11 @@
--- a/meson.build
+++ b/meson.build
@@ -40,7 +40,7 @@ if cpu in ['ppc', 'ppc64']
'arch' / cpu / 'retfromsyscall.c'
]
endif
-if cpu not in ['mips', 'mips64', 'ppc', 'ppc64', 's390x']
+if cpu not in ['loongarch64', 'mips', 'mips64', 'ppc', 'ppc64', 's390x', 'x86']
project_source_files += [
'arch' / cpu / 'trampoline.c'
]

View File

@ -1,122 +0,0 @@
--- a/test_libucontext.c
+++ b/test_libucontext.c
@@ -9,6 +9,9 @@
#include <string.h>
#include <libucontext/libucontext.h>
+#define handle_error(msg) \
+ do { perror(msg); exit(EXIT_FAILURE); } while (0)
+
static libucontext_ucontext_t ctx[3];
@@ -36,7 +39,8 @@ static void f1 (int a, int b, int c, int
printf("looks like all arguments are passed correctly\n");
printf("swap back to f2\n");
- libucontext_swapcontext(&ctx[1], &ctx[2]);
+ if (libucontext_swapcontext(&ctx[1], &ctx[2]) != 0)
+ handle_error("libucontext_swapcontext");
printf("finish f1\n");
}
@@ -44,7 +48,8 @@ static void f1 (int a, int b, int c, int
static void f2 (void) {
printf("start f2\n");
printf("swap to f1\n");
- libucontext_swapcontext(&ctx[2], &ctx[1]);
+ if (libucontext_swapcontext(&ctx[2], &ctx[1]) != 0)
+ handle_error("libucontext_swapcontext");
printf("finish f2, should swap to f1\n");
}
@@ -63,7 +68,8 @@ int main (int argc, const char *argv[])
printf("setting up context 1\n");
- libucontext_getcontext(&ctx[1]);
+ if (libucontext_getcontext(&ctx[1]) != 0)
+ handle_error("libucontext_getcontext");
ctx[1].uc_stack.ss_sp = st1;
ctx[1].uc_stack.ss_size = sizeof st1;
ctx[1].uc_link = &ctx[0];
@@ -83,16 +89,20 @@ int main (int argc, const char *argv[])
printf("doing initial swapcontext\n");
- libucontext_swapcontext(&ctx[0], &ctx[2]);
+ if (libucontext_swapcontext(&ctx[0], &ctx[2]) != 0)
+ handle_error("libucontext_swapcontext");
printf("returned from initial swapcontext\n");
/* test ability to use getcontext/setcontext without makecontext */
- libucontext_getcontext(&ctx[1]);
+ if (libucontext_getcontext(&ctx[1]) != 0)
+ handle_error("libucontext_getcontext");
printf("done = %d\n", done);
- if (done++ == 0) libucontext_setcontext(&ctx[1]);
+ if (done++ == 0)
+ if (libucontext_setcontext(&ctx[1]) != 0)
+ handle_error("libucontext_setcontext");
if (done != 2) {
fprintf(stderr, "wrong value for done. got %d, expected 2\n", done);
abort();
--- a/test_libucontext_posix.c
+++ b/test_libucontext_posix.c
@@ -9,6 +9,9 @@
#include <string.h>
#include <ucontext.h>
+#define handle_error(msg) \
+ do { perror(msg); exit(EXIT_FAILURE); } while (0)
+
static ucontext_t ctx[3];
@@ -36,7 +39,8 @@ static void f1 (int a, int b, int c, int
printf("looks like all arguments are passed correctly\n");
printf("swap back to f2\n");
- swapcontext(&ctx[1], &ctx[2]);
+ if (swapcontext(&ctx[1], &ctx[2]) != 0)
+ handle_error("swapcontext");
printf("finish f1\n");
}
@@ -44,7 +48,8 @@ static void f1 (int a, int b, int c, int
static void f2 (void) {
printf("start f2\n");
printf("swap to f1\n");
- swapcontext(&ctx[2], &ctx[1]);
+ if (swapcontext(&ctx[2], &ctx[1]) != 0)
+ handle_error("swapcontext");
printf("finish f2, should swap to f1\n");
}
@@ -83,16 +88,19 @@ int main (int argc, const char *argv[])
printf("doing initial swapcontext\n");
- swapcontext(&ctx[0], &ctx[2]);
-
+ if (swapcontext(&ctx[0], &ctx[2]) != 0)
+ handle_error("swapcontext");
printf("returned from initial swapcontext\n");
/* test ability to use getcontext/setcontext without makecontext */
- getcontext(&ctx[1]);
+ if (getcontext(&ctx[1]) != 0)
+ handle_error("getcontext");
printf("done = %d\n", done);
- if (done++ == 0) setcontext(&ctx[1]);
+ if (done++ == 0)
+ if (setcontext(&ctx[1]) != 0)
+ handle_error("setcontext");
if (done != 2) {
fprintf(stderr, "wrong value for done. got %d, expected 2\n", done);
abort();