From ff740b6b07e261e28dcf09e5665b289383e50d0f Mon Sep 17 00:00:00 2001 From: jb Date: Mon, 9 Mar 1998 04:46:26 +0000 Subject: [PATCH] Add FreeBSD/Alpha code to initialise a jmpbuf for a created thread. Change a bunch of __alpha references to __alpha__. --- lib/libc_r/uthread/uthread_create.c | 22 +++++++++++++++++++--- lib/libc_r/uthread/uthread_kern.c | 8 ++++---- lib/libkse/thread/thr_create.c | 22 +++++++++++++++++++--- lib/libkse/thread/thr_kern.c | 8 ++++---- lib/libpthread/thread/thr_create.c | 22 +++++++++++++++++++--- lib/libpthread/thread/thr_kern.c | 8 ++++---- 6 files changed, 69 insertions(+), 21 deletions(-) diff --git a/lib/libc_r/uthread/uthread_create.c b/lib/libc_r/uthread/uthread_create.c index 398ff21e435d..da00e4d44038 100644 --- a/lib/libc_r/uthread/uthread_create.c +++ b/lib/libc_r/uthread/uthread_create.c @@ -117,9 +117,15 @@ _thread_create(pthread_t * thread, const pthread_attr_t * attr, if (parent == NULL) { /* Use the user start function: */ #if defined(__FreeBSD__) +#if defined(__alpha__) + new_thread->saved_jmp_buf[0]._jb[2] = (long) _thread_start; + new_thread->saved_jmp_buf[0]._jb[4 + R_RA] = 0; + new_thread->saved_jmp_buf[0]._jb[4 + R_T12] = (long) _thread_start; +#else new_thread->saved_jmp_buf[0]._jb[0] = (long) _thread_start; +#endif #elif defined(__NetBSD__) -#if defined(__alpha) +#if defined(__alpha__) new_thread->saved_jmp_buf[2] = (long) _thread_start; new_thread->saved_jmp_buf[4 + R_RA] = 0; new_thread->saved_jmp_buf[4 + R_T12] = (long) _thread_start; @@ -135,9 +141,15 @@ _thread_create(pthread_t * thread, const pthread_attr_t * attr, * function: */ #if defined(__FreeBSD__) +#if defined(__alpha__) + new_thread->saved_jmp_buf[0]._jb[2] = (long) _thread_start_sig_handler; + new_thread->saved_jmp_buf[0]._jb[4 + R_RA] = 0; + new_thread->saved_jmp_buf[0]._jb[4 + R_T12] = (long) _thread_start_sig_handler; +#else new_thread->saved_jmp_buf[0]._jb[0] = (int) _thread_start_sig_handler; +#endif #elif defined(__NetBSD__) -#if defined(__alpha) +#if defined(__alpha__) new_thread->saved_jmp_buf[2] = (long) _thread_start_sig_handler; new_thread->saved_jmp_buf[4 + R_RA] = 0; new_thread->saved_jmp_buf[4 + R_T12] = (long) _thread_start_sig_handler; @@ -151,9 +163,13 @@ _thread_create(pthread_t * thread, const pthread_attr_t * attr, /* The stack starts high and builds down: */ #if defined(__FreeBSD__) +#if defined(__alpha__) + new_thread->saved_jmp_buf[0]._jb[4 + R_SP] = (long) new_thread->stack + pattr->stacksize_attr - sizeof(double); +#else new_thread->saved_jmp_buf[0]._jb[2] = (int) (new_thread->stack + pattr->stacksize_attr - sizeof(double)); +#endif #elif defined(__NetBSD__) -#if defined(__alpha) +#if defined(__alpha__) new_thread->saved_jmp_buf[4 + R_SP] = (long) new_thread->stack + pattr->stacksize_attr - sizeof(double); #else new_thread->saved_jmp_buf[2] = (long) new_thread->stack + pattr->stacksize_attr - sizeof(double); diff --git a/lib/libc_r/uthread/uthread_kern.c b/lib/libc_r/uthread/uthread_kern.c index 925d5bf052ae..eeae75cc39b1 100644 --- a/lib/libc_r/uthread/uthread_kern.c +++ b/lib/libc_r/uthread/uthread_kern.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: uthread_kern.c,v 1.5 1997/04/01 22:51:48 jb Exp $ + * $Id: uthread_kern.c,v 1.6 1998/02/13 01:27:33 julian Exp $ * */ #include @@ -62,7 +62,7 @@ _thread_signal(pthread_t pthread, int sig); void _thread_kern_sched(struct sigcontext * scp) { -#ifndef __alpha +#ifndef __alpha__ char *fdata; #endif int i; @@ -89,7 +89,7 @@ _thread_kern_sched(struct sigcontext * scp) */ memcpy(&_thread_run->saved_sigcontext, scp, sizeof(_thread_run->saved_sigcontext)); -#ifndef __alpha +#ifndef __alpha__ /* Point to the floating point data in the running thread: */ fdata = _thread_run->saved_fp; @@ -788,7 +788,7 @@ __asm__("fnsave %0": :"m"(*fdata)); } /* Check if a signal context was saved: */ if (_thread_run->sig_saved == 1) { -#ifndef __alpha +#ifndef __alpha__ /* * Point to the floating point data in the * running thread: diff --git a/lib/libkse/thread/thr_create.c b/lib/libkse/thread/thr_create.c index 398ff21e435d..da00e4d44038 100644 --- a/lib/libkse/thread/thr_create.c +++ b/lib/libkse/thread/thr_create.c @@ -117,9 +117,15 @@ _thread_create(pthread_t * thread, const pthread_attr_t * attr, if (parent == NULL) { /* Use the user start function: */ #if defined(__FreeBSD__) +#if defined(__alpha__) + new_thread->saved_jmp_buf[0]._jb[2] = (long) _thread_start; + new_thread->saved_jmp_buf[0]._jb[4 + R_RA] = 0; + new_thread->saved_jmp_buf[0]._jb[4 + R_T12] = (long) _thread_start; +#else new_thread->saved_jmp_buf[0]._jb[0] = (long) _thread_start; +#endif #elif defined(__NetBSD__) -#if defined(__alpha) +#if defined(__alpha__) new_thread->saved_jmp_buf[2] = (long) _thread_start; new_thread->saved_jmp_buf[4 + R_RA] = 0; new_thread->saved_jmp_buf[4 + R_T12] = (long) _thread_start; @@ -135,9 +141,15 @@ _thread_create(pthread_t * thread, const pthread_attr_t * attr, * function: */ #if defined(__FreeBSD__) +#if defined(__alpha__) + new_thread->saved_jmp_buf[0]._jb[2] = (long) _thread_start_sig_handler; + new_thread->saved_jmp_buf[0]._jb[4 + R_RA] = 0; + new_thread->saved_jmp_buf[0]._jb[4 + R_T12] = (long) _thread_start_sig_handler; +#else new_thread->saved_jmp_buf[0]._jb[0] = (int) _thread_start_sig_handler; +#endif #elif defined(__NetBSD__) -#if defined(__alpha) +#if defined(__alpha__) new_thread->saved_jmp_buf[2] = (long) _thread_start_sig_handler; new_thread->saved_jmp_buf[4 + R_RA] = 0; new_thread->saved_jmp_buf[4 + R_T12] = (long) _thread_start_sig_handler; @@ -151,9 +163,13 @@ _thread_create(pthread_t * thread, const pthread_attr_t * attr, /* The stack starts high and builds down: */ #if defined(__FreeBSD__) +#if defined(__alpha__) + new_thread->saved_jmp_buf[0]._jb[4 + R_SP] = (long) new_thread->stack + pattr->stacksize_attr - sizeof(double); +#else new_thread->saved_jmp_buf[0]._jb[2] = (int) (new_thread->stack + pattr->stacksize_attr - sizeof(double)); +#endif #elif defined(__NetBSD__) -#if defined(__alpha) +#if defined(__alpha__) new_thread->saved_jmp_buf[4 + R_SP] = (long) new_thread->stack + pattr->stacksize_attr - sizeof(double); #else new_thread->saved_jmp_buf[2] = (long) new_thread->stack + pattr->stacksize_attr - sizeof(double); diff --git a/lib/libkse/thread/thr_kern.c b/lib/libkse/thread/thr_kern.c index 925d5bf052ae..eeae75cc39b1 100644 --- a/lib/libkse/thread/thr_kern.c +++ b/lib/libkse/thread/thr_kern.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: uthread_kern.c,v 1.5 1997/04/01 22:51:48 jb Exp $ + * $Id: uthread_kern.c,v 1.6 1998/02/13 01:27:33 julian Exp $ * */ #include @@ -62,7 +62,7 @@ _thread_signal(pthread_t pthread, int sig); void _thread_kern_sched(struct sigcontext * scp) { -#ifndef __alpha +#ifndef __alpha__ char *fdata; #endif int i; @@ -89,7 +89,7 @@ _thread_kern_sched(struct sigcontext * scp) */ memcpy(&_thread_run->saved_sigcontext, scp, sizeof(_thread_run->saved_sigcontext)); -#ifndef __alpha +#ifndef __alpha__ /* Point to the floating point data in the running thread: */ fdata = _thread_run->saved_fp; @@ -788,7 +788,7 @@ __asm__("fnsave %0": :"m"(*fdata)); } /* Check if a signal context was saved: */ if (_thread_run->sig_saved == 1) { -#ifndef __alpha +#ifndef __alpha__ /* * Point to the floating point data in the * running thread: diff --git a/lib/libpthread/thread/thr_create.c b/lib/libpthread/thread/thr_create.c index 398ff21e435d..da00e4d44038 100644 --- a/lib/libpthread/thread/thr_create.c +++ b/lib/libpthread/thread/thr_create.c @@ -117,9 +117,15 @@ _thread_create(pthread_t * thread, const pthread_attr_t * attr, if (parent == NULL) { /* Use the user start function: */ #if defined(__FreeBSD__) +#if defined(__alpha__) + new_thread->saved_jmp_buf[0]._jb[2] = (long) _thread_start; + new_thread->saved_jmp_buf[0]._jb[4 + R_RA] = 0; + new_thread->saved_jmp_buf[0]._jb[4 + R_T12] = (long) _thread_start; +#else new_thread->saved_jmp_buf[0]._jb[0] = (long) _thread_start; +#endif #elif defined(__NetBSD__) -#if defined(__alpha) +#if defined(__alpha__) new_thread->saved_jmp_buf[2] = (long) _thread_start; new_thread->saved_jmp_buf[4 + R_RA] = 0; new_thread->saved_jmp_buf[4 + R_T12] = (long) _thread_start; @@ -135,9 +141,15 @@ _thread_create(pthread_t * thread, const pthread_attr_t * attr, * function: */ #if defined(__FreeBSD__) +#if defined(__alpha__) + new_thread->saved_jmp_buf[0]._jb[2] = (long) _thread_start_sig_handler; + new_thread->saved_jmp_buf[0]._jb[4 + R_RA] = 0; + new_thread->saved_jmp_buf[0]._jb[4 + R_T12] = (long) _thread_start_sig_handler; +#else new_thread->saved_jmp_buf[0]._jb[0] = (int) _thread_start_sig_handler; +#endif #elif defined(__NetBSD__) -#if defined(__alpha) +#if defined(__alpha__) new_thread->saved_jmp_buf[2] = (long) _thread_start_sig_handler; new_thread->saved_jmp_buf[4 + R_RA] = 0; new_thread->saved_jmp_buf[4 + R_T12] = (long) _thread_start_sig_handler; @@ -151,9 +163,13 @@ _thread_create(pthread_t * thread, const pthread_attr_t * attr, /* The stack starts high and builds down: */ #if defined(__FreeBSD__) +#if defined(__alpha__) + new_thread->saved_jmp_buf[0]._jb[4 + R_SP] = (long) new_thread->stack + pattr->stacksize_attr - sizeof(double); +#else new_thread->saved_jmp_buf[0]._jb[2] = (int) (new_thread->stack + pattr->stacksize_attr - sizeof(double)); +#endif #elif defined(__NetBSD__) -#if defined(__alpha) +#if defined(__alpha__) new_thread->saved_jmp_buf[4 + R_SP] = (long) new_thread->stack + pattr->stacksize_attr - sizeof(double); #else new_thread->saved_jmp_buf[2] = (long) new_thread->stack + pattr->stacksize_attr - sizeof(double); diff --git a/lib/libpthread/thread/thr_kern.c b/lib/libpthread/thread/thr_kern.c index 925d5bf052ae..eeae75cc39b1 100644 --- a/lib/libpthread/thread/thr_kern.c +++ b/lib/libpthread/thread/thr_kern.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: uthread_kern.c,v 1.5 1997/04/01 22:51:48 jb Exp $ + * $Id: uthread_kern.c,v 1.6 1998/02/13 01:27:33 julian Exp $ * */ #include @@ -62,7 +62,7 @@ _thread_signal(pthread_t pthread, int sig); void _thread_kern_sched(struct sigcontext * scp) { -#ifndef __alpha +#ifndef __alpha__ char *fdata; #endif int i; @@ -89,7 +89,7 @@ _thread_kern_sched(struct sigcontext * scp) */ memcpy(&_thread_run->saved_sigcontext, scp, sizeof(_thread_run->saved_sigcontext)); -#ifndef __alpha +#ifndef __alpha__ /* Point to the floating point data in the running thread: */ fdata = _thread_run->saved_fp; @@ -788,7 +788,7 @@ __asm__("fnsave %0": :"m"(*fdata)); } /* Check if a signal context was saved: */ if (_thread_run->sig_saved == 1) { -#ifndef __alpha +#ifndef __alpha__ /* * Point to the floating point data in the * running thread: