From 69186ed701cbfc740d08df24d46b8d184b6f57eb Mon Sep 17 00:00:00 2001 From: Daniel Eischen Date: Tue, 28 Dec 1999 18:12:07 +0000 Subject: Change stack allocation algorithm to make better use of memory (it was leaving an unused block). Also protect the global stack pointer from context changes while fiddling with it. --- lib/libpthread/thread/thr_init.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'lib/libpthread/thread/thr_init.c') diff --git a/lib/libpthread/thread/thr_init.c b/lib/libpthread/thread/thr_init.c index bab7e5b2fc0a..c888697d0c8f 100644 --- a/lib/libpthread/thread/thr_init.c +++ b/lib/libpthread/thread/thr_init.c @@ -187,13 +187,11 @@ _thread_init(void) SLIST_INIT(&_stackq); /* Create the red zone for the main stack. */ - if (mmap((void *) USRSTACK - - PTHREAD_STACK_INITIAL, - PTHREAD_STACK_GUARD, 0, MAP_ANON, - -1, 0) == MAP_FAILED) { + if (mmap((void *) USRSTACK - PTHREAD_STACK_INITIAL - + PTHREAD_STACK_GUARD, PTHREAD_STACK_GUARD, 0, MAP_ANON, + -1, 0) == MAP_FAILED) PANIC("Cannot allocate red zone for initial thread"); - } - + /* * Write a magic value to the thread structure * to help identify valid ones: @@ -248,7 +246,7 @@ _thread_init(void) /* Get the signal handler details: */ else if (_thread_sys_sigaction(i, NULL, - &_thread_sigact[i - 1]) != 0) { + &_thread_sigact[i - 1]) != 0) { /* * Abort this process if signal * initialisation fails: -- cgit v1.2.3