aboutsummaryrefslogtreecommitdiff
path: root/lib/libc_r
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2003-03-05 04:39:24 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2003-03-05 04:39:24 +0000
commitcafd6dbd76d24e22bfdcdb0a5cb3699662f32622 (patch)
tree43c9fbba16caef13b08438e9431452fba63c0dde /lib/libc_r
parentd4f7f050a8a51c7fdea43ed54910ac3a42adbe48 (diff)
downloadsrc-cafd6dbd76d24e22bfdcdb0a5cb3699662f32622.tar.gz
src-cafd6dbd76d24e22bfdcdb0a5cb3699662f32622.zip
Fix threaded applications on ia64 that are linked dynamicly. We did
not save (restore) the global pointer (GP) in the jmpbuf in setjmp (longjmp) because it's not needed in general. GP is considered a scratch register at callsites and hence is always restored after a call (when it's possible that the call resolves to a symbol in a different loadmodule; otherwise GP does not have to be saved and restored at all), including calls to setjmp/longjmp. There's just one problem with this now that we use setjmp/longjmp for context switching: A new context must have GP defined properly for the thread's entry point. This means that we need to put GP in the jmpbuf and consequently that we have to restore is in longjmp. This automaticly requires us to save it as well. When setjmp/longjmp isn't used for context switching, this can be reverted again.
Notes
Notes: svn path=/head/; revision=111897
Diffstat (limited to 'lib/libc_r')
-rw-r--r--lib/libc_r/uthread/pthread_private.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/libc_r/uthread/pthread_private.h b/lib/libc_r/uthread/pthread_private.h
index b2f7a61afa4a..143772d1ac7f 100644
--- a/lib/libc_r/uthread/pthread_private.h
+++ b/lib/libc_r/uthread/pthread_private.h
@@ -109,6 +109,7 @@
#define SET_RETURN_ADDR_JB(jb, ra) \
do { \
*((unsigned long*)JMPBUF_ADDR_OF(jb,J_B0)) = ((long*)(ra))[0]; \
+ *((unsigned long*)JMPBUF_ADDR_OF(jb,J_GP)) = ((long*)(ra))[1]; \
*((unsigned long*)JMPBUF_ADDR_OF(jb,J_PFS)) &= ~0x1FFFFFFFFFUL; \
} while (0)
#define SET_STACK_JB(jb, stk, sz) \