From 88983e2fa584a0ccd018f2290d087e4db4c46350 Mon Sep 17 00:00:00 2001 From: jasone Date: Tue, 6 Jul 1999 00:25:38 +0000 Subject: Always use growable thread stacks on the i386. The VM_STACK kernel option must be made default for the alpha before growable thread stacks are enabled for the alpha. --- lib/libkse/Makefile | 5 +---- lib/libkse/thread/thr_create.c | 6 ++---- lib/libkse/thread/thr_init.c | 6 ++---- lib/libkse/thread/thr_private.h | 24 ++++++++++-------------- 4 files changed, 15 insertions(+), 26 deletions(-) (limited to 'lib/libkse') diff --git a/lib/libkse/Makefile b/lib/libkse/Makefile index e5211d9..eddc4ba 100644 --- a/lib/libkse/Makefile +++ b/lib/libkse/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.16 1999/07/05 00:35:14 jasone Exp $ +# $Id: Makefile,v 1.17 1999/07/05 00:38:12 jasone Exp $ # # All library objects contain rcsid strings by default; they may be # excluded as a space-saving measure. To produce a library that does @@ -15,9 +15,6 @@ CFLAGS+=-DPTHREAD_KERNEL -D_THREAD_SAFE -I${.CURDIR}/uthread # thread locking. CFLAGS+=-D_LOCK_DEBUG -# Uncomment this if you want libc_r to use growable stacks. -#CFLAGS+=-D_PTHREAD_GSTACK - AINC= -I${.CURDIR}/../libc/${MACHINE_ARCH} -I${.CURDIR}/uthread PRECIOUSLIB= yes diff --git a/lib/libkse/thread/thr_create.c b/lib/libkse/thread/thr_create.c index 1b12c7b..f5631a5 100644 --- a/lib/libkse/thread/thr_create.c +++ b/lib/libkse/thread/thr_create.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: uthread_create.c,v 1.13 1999/06/20 08:28:14 jb Exp $ + * $Id: uthread_create.c,v 1.14 1999/07/05 00:35:17 jasone Exp $ */ #include #include @@ -37,10 +37,8 @@ #include #include #include -#ifdef _PTHREAD_GSTACK #include #include -#endif #ifdef _THREAD_SAFE #include #include @@ -81,7 +79,7 @@ pthread_create(pthread_t * thread, const pthread_attr_t * attr, /* Check if a stack was specified in the thread attributes: */ if ((stack = pattr->stackaddr_attr) != NULL) { } -#ifdef _PTHREAD_GSTACK +#ifdef __i386__ /* Allocate memory for a default-size stack: */ else if (pattr->stacksize_attr == PTHREAD_STACK_DEFAULT) { struct stack * spare_stack; diff --git a/lib/libkse/thread/thr_init.c b/lib/libkse/thread/thr_init.c index 9528e00..a5b7a82 100644 --- a/lib/libkse/thread/thr_init.c +++ b/lib/libkse/thread/thr_init.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: uthread_init.c,v 1.12 1999/06/23 15:01:21 dt Exp $ + * $Id: uthread_init.c,v 1.13 1999/07/05 00:35:19 jasone Exp $ */ /* Allocate space for global thread variables here: */ @@ -45,10 +45,8 @@ #include #include #include -#ifdef _PTHREAD_GSTACK #include #include -#endif #ifdef _THREAD_SAFE #include #include @@ -182,7 +180,7 @@ _thread_init(void) /* Initialize the scheduling switch hook routine: */ _sched_switch_hook = NULL; -#ifdef _PTHREAD_GSTACK +#ifdef __i386__ /* Initialize the thread stack cache: */ SLIST_INIT(&_stackq); diff --git a/lib/libkse/thread/thr_private.h b/lib/libkse/thread/thr_private.h index 1da2151..513d81e 100644 --- a/lib/libkse/thread/thr_private.h +++ b/lib/libkse/thread/thr_private.h @@ -31,7 +31,7 @@ * * Private thread definitions for the uthread kernel. * - * $Id: pthread_private.h,v 1.20 1999/06/20 08:28:08 jb Exp $ + * $Id: pthread_private.h,v 1.21 1999/07/05 00:35:17 jasone Exp $ */ #ifndef _PTHREAD_PRIVATE_H @@ -335,23 +335,23 @@ struct pthread_attr { * Miscellaneous definitions. */ #define PTHREAD_STACK_DEFAULT 65536 -#ifdef _PTHREAD_GSTACK /* Size of red zone at the end of each stack. */ #define PTHREAD_STACK_GUARD 4096 /* Maximum size of initial thread's stack. This perhaps deserves to be larger - * than the stacks of other threads, since legacy applications are likely to run + * than the stacks of other threads, since many applications are likely to run * almost entirely on this stack. */ #define PTHREAD_STACK_INITIAL 0x100000 /* Address immediately beyond the beginning of the initial thread stack. */ #if defined(__FreeBSD__) -# if defined(__alpha__) -# define PTHREAD_STACK_TOP 0x160022000 -# else -# define PTHREAD_STACK_TOP 0xbfbde000 -# endif +# if defined(__i386__) +# define PTHREAD_STACK_TOP 0xbfbde000 +# elif defined(__alpha__) +# define PTHREAD_STACK_TOP 0x160022000 +# else +# error "Don't recognize this architecture!" +# endif #else -# error "Don't recognize this operating system!" -#endif +# error "Don't recognize this operating system!" #endif #define PTHREAD_DEFAULT_PRIORITY 64 #define PTHREAD_MAX_PRIORITY 126 @@ -673,12 +673,10 @@ struct pthread { int lineno; /* Source line number. */ }; -#ifdef _PTHREAD_GSTACK /* Spare thread stack. */ struct stack { SLIST_ENTRY(stack) qe; /* Queue entry for this stack. */ }; -#endif /* * Global variables for the uthread kernel. @@ -889,7 +887,6 @@ SCLASS pthread_switch_routine_t _sched_switch_hook #endif ; -#ifdef _PTHREAD_GSTACK /* Spare stack queue. Stacks of default size are cached in order to reduce * thread creation time. Spare stacks are used in LIFO order to increase cache * locality. */ @@ -905,7 +902,6 @@ SCLASS void * _next_stack = (void *) PTHREAD_STACK_TOP - PTHREAD_STACK_INITIAL - PTHREAD_STACK_DEFAULT - (2 * PTHREAD_STACK_GUARD) #endif ; -#endif /* Used for _PTHREADS_INVARIANTS checking. */ SCLASS int _thread_kern_new_state -- cgit v1.1