Commit Graph

15 Commits (acff6c83eb28c0c123b4231e88056f6a90793e90)

Author SHA1 Message Date
Gabriel Ivașcu acff6c83eb Makefile: i386, i686 -> x86 2019-10-22 18:08:47 +03:00
Gabriel Ivașcu 2e15b38327 Makefile: Handle static library at clean/install 2019-04-12 10:48:24 +03:00
Gabriel Ivașcu 9cc1a2c0e6 Build static library too 2019-04-09 16:07:39 +03:00
Bobby Bingham 2610c7faa7 ppc32/64: rewrite get/set/swapcontext in assembly
getcontext cannot be correctly implemented in C.

If this calls another function, as it does to call syscall, it needs to
first spill its return address to the stack.  If, after getcontext returns,
its caller then calls other functions, this saved return address can be
clobbered.  When the context saved by getcontext is later restored, the
(now clobbered) return address will be reloaded from the stack, and the
second return from getcontext will return to the wrong location.

Because the powerpc swapcontext syscall allows either the old context or
new context pointers to be null, it is usable for implementing all of
get/set/swapcontext.

We therefore rewrite swapcontext in assembly, and get/setcontext as simple
assembly function wrappers around swapcontext.

The one piece we keep in C is the code to check the return value of the
system call and to set errno.  This code was actually unnecessary before --
libc does this within syscall.  However, now that the system call is made
directly in assembly, bypassing libc, it is truly necessary.  Because errno
is thread-local and the details of how to set it can vary by libc, this
code remains written in C.
2019-04-05 14:44:54 -05:00
William Pitcock f0741bc7a0 build: use -lucontext instead of libucontext.so in linker flags for test program 2018-02-15 04:41:22 +00:00
William Pitcock 70089a405c build: use absolute path for LD_LIBRARY_PATH when testing 2018-02-14 03:30:50 +00:00
William Pitcock 0188f29771 build: remove test_libucontext on make clean 2018-02-14 03:01:35 +00:00
William Pitcock c28af0399e build: rebuild test program if it is modified 2018-02-01 01:27:13 +00:00
William Pitcock 3f63152bbc build: add -Iarch/${ARCH} to CFLAGS 2018-01-31 20:37:00 +00:00
William Pitcock b686d707b2 build: fix arch detection 2018-01-31 05:58:26 +00:00
William Pitcock a6dfb59ef2 build: default ARCH to $(uname -m) 2018-01-31 04:13:32 +00:00
William Pitcock f17103b6f4 build: build testsuite with -ggdb3 2018-01-31 04:12:09 +00:00
William Pitcock 29225e0974 build: add libucontext test program 2018-01-30 03:53:04 +00:00
William Pitcock da10e5a66d implement ucontext functions on x86_64 2018-01-30 03:41:02 +00:00
William Pitcock 6062fc83b1 don't bother with glibc stuff afterall, kernel defines ABI to use 2018-01-29 21:50:49 +00:00