From owner-p4-projects@FreeBSD.ORG Tue Dec 2 16:55:11 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 611EA16A4D0; Tue, 2 Dec 2003 16:55:11 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3B89C16A4CE for ; Tue, 2 Dec 2003 16:55:11 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 41E2443FB1 for ; Tue, 2 Dec 2003 16:55:08 -0800 (PST) (envelope-from peter@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id hB30t8XJ089668 for ; Tue, 2 Dec 2003 16:55:08 -0800 (PST) (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id hB30t7Uw089665 for perforce@freebsd.org; Tue, 2 Dec 2003 16:55:07 -0800 (PST) (envelope-from peter@freebsd.org) Date: Tue, 2 Dec 2003 16:55:07 -0800 (PST) Message-Id: <200312030055.hB30t7Uw089665@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to peter@freebsd.org using -f From: Peter Wemm To: Perforce Change Reviews Subject: PERFORCE change 43327 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Dec 2003 00:55:11 -0000 http://perforce.freebsd.org/chv.cgi?CH=43327 Change 43327 by peter@peter_overcee on 2003/12/02 16:54:26 grumble. submit this before I lose it, since I still can't get a response from re@ about it. Affected files ... .. //depot/projects/hammer/lib/libc_r/uthread/uthread_create.c#5 edit .. //depot/projects/hammer/lib/libc_r/uthread/uthread_init.c#5 edit .. //depot/projects/hammer/lib/libc_r/uthread/uthread_sig.c#7 edit Differences ... ==== //depot/projects/hammer/lib/libc_r/uthread/uthread_create.c#5 (text+ko) ==== @@ -73,6 +73,9 @@ pthread_t new_thread; pthread_attr_t pattr; void *stack; +#if !defined(__ia64__) + u_long stackp; +#endif if (thread == NULL) return(EINVAL); @@ -145,10 +148,12 @@ SET_RETURN_ADDR_JB(new_thread->ctx.jb, _thread_start); #if !defined(__ia64__) + stackp = (long)new_thread->stack + pattr->stacksize_attr - sizeof(double); +#if defined(__amd64__) + stackp &= ~0xFUL; +#endif /* The stack starts high and builds down: */ - SET_STACK_JB(new_thread->ctx.jb, - (long)new_thread->stack + pattr->stacksize_attr - - sizeof(double)); + SET_STACK_JB(new_thread->ctx.jb, stackp); #else SET_STACK_JB(new_thread->ctx.jb, (long)new_thread->stack, pattr->stacksize_attr); ==== //depot/projects/hammer/lib/libc_r/uthread/uthread_init.c#5 (text+ko) ==== @@ -208,6 +208,9 @@ size_t len; int mib[2]; int sched_stack_size; /* Size of scheduler stack. */ +#if !defined(__ia64__) + u_long stackp; +#endif struct clockinfo clockinfo; struct sigaction act; @@ -374,8 +377,11 @@ /* Setup the context for the scheduler: */ _setjmp(_thread_kern_sched_jb); #if !defined(__ia64__) - SET_STACK_JB(_thread_kern_sched_jb, _thread_kern_sched_stack + - sched_stack_size - sizeof(double)); + stackp = (long)_thread_kern_sched_stack + sched_stack_size - sizeof(double); +#if defined(__amd64__) + stackp &= ~0xFUL; +#endif + SET_STACK_JB(_thread_kern_sched_jb, stackp); #else SET_STACK_JB(_thread_kern_sched_jb, _thread_kern_sched_stack, sched_stack_size); ==== //depot/projects/hammer/lib/libc_r/uthread/uthread_sig.c#7 (text+ko) ==== @@ -1048,13 +1048,20 @@ * Leave a little space on the stack and round down to the * nearest aligned word: */ +#if defined(__amd64__) + stackp -= 128; /* Skip over 128 byte red-zone */ +#endif stackp -= sizeof(double); +#if defined(__amd64__) + stackp &= ~0xFUL; +#else stackp &= ~0x3UL; #endif +#endif /* Allocate room on top of the stack for a new signal frame: */ stackp -= sizeof(struct pthread_signal_frame); -#if defined(__ia64__) +#if defined(__ia64__) || defined(__amd64__) stackp &= ~0xFUL; #endif @@ -1087,6 +1094,9 @@ */ #if !defined(__ia64__) stackp -= sizeof(double); +#if defined(__amd64__) + stackp &= ~0xFUL; +#endif #endif _setjmp(thread->ctx.jb); #if !defined(__ia64__)