Subject: Re: CVS commit: src/lib (libpthread)
To: None <source-changes@netbsd.org>
From: Geoff Wing <mason@primenet.com.au>
List: source-changes
Date: 07/19/2004 06:17:27
Geoff Wing <mason@primenet.com.au> typed:
: Chuck Silvers <chs@netbsd.org> typed:
:: cvs rdiff -r1.12 -r1.13 src/lib/libpthread/pthread_stack.c

It's this change that's causing a problem.  In pthread__stackid_setup():

        /* Set up an initial ucontext pointer to a "safe" area */
-       t->pt_uc =(ucontext_t *)(void *)((char *)t->pt_stack.ss_sp + 
-           t->pt_stack.ss_size - (pagesize/2));
-#ifdef _UC_UCONTEXT_ALIGN
-       t->pt_uc = (ucontext_t *)((uintptr_t)t->pt_uc & _UC_UCONTEXT_ALIGN);
-#endif
+       t->pt_uc = (ucontext_t *)
+               STACK_ALIGN(STACK_GROW(t->pt_stack.ss_sp, pagesize / 2),
+                           ~_UC_UCONTEXT_ALIGN);

Guess fix needs something like:

--- pthread_stack.c.org	2004-07-19 11:25:25.000000000 +1000
+++ pthread_stack.c	2004-07-19 16:16:11.000000000 +1000
@@ -181,7 +181,8 @@
 
 	/* Set up an initial ucontext pointer to a "safe" area */
 	t->pt_uc = (ucontext_t *)
-		STACK_ALIGN(STACK_GROW(t->pt_stack.ss_sp, pagesize / 2),
+		STACK_ALIGN(STACK_GROW(t->pt_stack.ss_sp,
+				       (pagesize / 2) - t->pt_stack.ss_size),
 			    ~_UC_UCONTEXT_ALIGN);
 
 	/* Protect the next-to-bottom stack page as a red zone. */

Regards,
Geoff