Module Name: src Committed By: manu Date: Wed Sep 12 02:00:55 UTC 2012
Modified Files: src/distrib/sets/lists/tests: mi src/lib/libc/arch/hppa/gen: swapcontext.S src/lib/libc/arch/mips/gen: _resumecontext.S swapcontext.S src/lib/libc/arch/powerpc64/gen: swapcontext.S src/lib/libc/arch/sparc/gen: swapcontext.S src/lib/libc/arch/sparc64/gen: swapcontext.S src/lib/libc/include: extern.h src/lib/libc/sys: Makefile.inc src/lib/libpthread: pthread_specific.c src/sys/arch/alpha/alpha: machdep.c src/sys/arch/alpha/include: mcontext.h src/sys/arch/sh3/include: mcontext.h src/sys/arch/sparc/include: mcontext.h src/sys/arch/sparc64/include: mcontext.h src/sys/sys: ucontext.h src/tests/lib/libc/sys: Makefile src/tests/lib/libpthread: Makefile Added Files: src/tests/lib/libc/sys: t_swapcontext.c src/tests/lib/libpthread: t_swapcontext.c Log Message: setcontext() used to be incompatible with -lpthread since it affected the TLS pointer, therefore wrecking the pthread environement. Some ports had _UC_TLSBASE flag or equivalent (_UC_UNIQUE on alpha) that controlled whether setcontext() would change the TLS pointer. This change let libpthread override setcontext() with its own version that unsets _UC_TLSBASE, enabling safe usage of setcontext() with -lpthread. We also have the following required changes here: - rename alpha's _UC_UNIQUE into _UC_TLSBASE - add _UC_TLSBASE definition in header file for all ports (powerpc, sh3, sparc and sparc64 lack the implementation for now) - introduce a libc stub that can be overriden for setcontext() - modify MD libcs swapcontext() implementations so that they use the setcontext() libc stub instead of doing a plain system call. While we are there: - document various MD _UC_* flags in header file - add libc and libpthread tests for swapcontext() behavior (hopefully helpful to spot MD problems introduced with this change) Future work: - Deciding whether kernel support or _UC_TLSBASE should be added for powerpc, sh3, sparc and sparc64 is left to portmasters sparc64 Approved by core@ To generate a diff of this commit: cvs rdiff -u -r1.490 -r1.491 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/hppa/gen/swapcontext.S cvs rdiff -u -r1.6 -r1.7 src/lib/libc/arch/mips/gen/_resumecontext.S cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/mips/gen/swapcontext.S cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/powerpc64/gen/swapcontext.S cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/sparc/gen/swapcontext.S cvs rdiff -u -r1.5 -r1.6 src/lib/libc/arch/sparc64/gen/swapcontext.S cvs rdiff -u -r1.19 -r1.20 src/lib/libc/include/extern.h cvs rdiff -u -r1.215 -r1.216 src/lib/libc/sys/Makefile.inc cvs rdiff -u -r1.21 -r1.22 src/lib/libpthread/pthread_specific.c cvs rdiff -u -r1.341 -r1.342 src/sys/arch/alpha/alpha/machdep.c cvs rdiff -u -r1.7 -r1.8 src/sys/arch/alpha/include/mcontext.h cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sh3/include/mcontext.h cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sparc/include/mcontext.h cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sparc64/include/mcontext.h cvs rdiff -u -r1.16 -r1.17 src/sys/sys/ucontext.h cvs rdiff -u -r1.27 -r1.28 src/tests/lib/libc/sys/Makefile cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/sys/t_swapcontext.c cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libpthread/Makefile cvs rdiff -u -r0 -r1.1 src/tests/lib/libpthread/t_swapcontext.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.