From owner-p4-projects Sun Dec 1 21: 5: 9 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 06D9737B404; Sun, 1 Dec 2002 21:05:05 -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 75D8037B401 for ; Sun, 1 Dec 2002 21:05:04 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2117443ECF for ; Sun, 1 Dec 2002 21:05:04 -0800 (PST) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id gB2511mV010356 for ; Sun, 1 Dec 2002 21:01:01 -0800 (PST) (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id gB25103C010353 for perforce@freebsd.org; Sun, 1 Dec 2002 21:01:00 -0800 (PST) Date: Sun, 1 Dec 2002 21:01:00 -0800 (PST) Message-Id: <200212020501.gB25103C010353@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar Subject: PERFORCE change 21796 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://perforce.freebsd.org/chv.cgi?CH=21796 Change 21796 by marcel@marcel_nfs on 2002/12/01 21:00:58 setjmp/longjmp based libc_r support. Affected files ... .. //depot/projects/ia64/lib/libc_r/uthread/pthread_private.h#13 edit .. //depot/projects/ia64/lib/libc_r/uthread/uthread_create.c#7 edit .. //depot/projects/ia64/lib/libc_r/uthread/uthread_init.c#8 edit .. //depot/projects/ia64/lib/libc_r/uthread/uthread_sig.c#7 edit Differences ... ==== //depot/projects/ia64/lib/libc_r/uthread/pthread_private.h#13 (text+ko) ==== @@ -210,6 +210,21 @@ } \ _thread_kern_new_state = 0; \ } while (0) +#elif defined(__ia64__) +#define GET_BSP_JB(jb) (*((unsigned long*)JMPBUF_ADDR_OF(jb,J_BSP))) +#define GET_STACK_JB(jb) (*((unsigned long*)JMPBUF_ADDR_OF(jb,J_SP))) +#define GET_STACK_SJB(sjb) GET_STACK_JB(sjb) +#define SET_RETURN_ADDR_JB(jb, ra) \ +do { \ + *((unsigned long*)JMPBUF_ADDR_OF(jb,J_B0)) = ((long*)(ra))[0]; \ + *((unsigned long*)JMPBUF_ADDR_OF(jb,J_PFS)) &= ~0x1FFFFFFFFFUL; \ +} while (0) +#define SET_STACK_JB(jb, stk, sz) \ +do { \ + UPD_STACK_JB(jb, stk + sz - 16); \ + GET_BSP_JB(jb) = (long)(stk); \ +} while (0) +#define UPD_STACK_JB(jb, stk) GET_STACK_JB(jb) = (long)(stk) #else #define PTHREAD_ASSERT(cond, msg) #define PTHREAD_ASSERT_NOT_IN_SYNCQ(thrd) @@ -414,7 +429,11 @@ /* * Miscellaneous definitions. */ +#if !defined(__ia64__) #define PTHREAD_STACK_DEFAULT 65536 +#else +#define PTHREAD_STACK_DEFAULT 0x40000 +#endif /* * Size of default red zone at the end of each stack. In actuality, this "red * zone" is merely an unmapped region, except in the case of the initial stack. @@ -432,7 +451,11 @@ * than the stacks of other threads, since many applications are likely to run * almost entirely on this stack. */ +#if !defined(__ia64__) #define PTHREAD_STACK_INITIAL 0x100000 +#else +#define PTHREAD_STACK_INITIAL 0x400000 +#endif /* * Define the different priority ranges. All applications have thread ==== //depot/projects/ia64/lib/libc_r/uthread/uthread_create.c#7 (text+ko) ==== @@ -144,10 +144,15 @@ */ SET_RETURN_ADDR_JB(new_thread->ctx.jb, _thread_start); +#if !defined(__ia64__) /* The stack starts high and builds down: */ SET_STACK_JB(new_thread->ctx.jb, (long)new_thread->stack + pattr->stacksize_attr - sizeof(double)); +#else + SET_STACK_JB(new_thread->ctx.jb, + (long)new_thread->stack, pattr->stacksize_attr); +#endif /* Copy the thread attributes: */ memcpy(&new_thread->attr, pattr, sizeof(struct pthread_attr)); ==== //depot/projects/ia64/lib/libc_r/uthread/uthread_init.c#8 (text+ko) ==== @@ -373,8 +373,13 @@ /* 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)); +#else + SET_STACK_JB(_thread_kern_sched_jb, _thread_kern_sched_stack, + sched_stack_size); +#endif SET_RETURN_ADDR_JB(_thread_kern_sched_jb, _thread_kern_scheduler); /* ==== //depot/projects/ia64/lib/libc_r/uthread/uthread_sig.c#7 (text+ko) ==== @@ -1043,15 +1043,20 @@ /* Get the top of the threads stack: */ stackp = GET_STACK_JB(thread->ctx.jb); +#if !defined(__ia64__) /* * Leave a little space on the stack and round down to the * nearest aligned word: */ stackp -= sizeof(double); stackp &= ~0x3UL; +#endif /* Allocate room on top of the stack for a new signal frame: */ stackp -= sizeof(struct pthread_signal_frame); +#if defined(__ia64__) + stackp &= ~0xFUL; +#endif psf = (struct pthread_signal_frame *) stackp; @@ -1080,9 +1085,15 @@ /* * Set up the context: */ +#if !defined(__ia64__) stackp -= sizeof(double); +#endif _setjmp(thread->ctx.jb); +#if !defined(__ia64__) SET_STACK_JB(thread->ctx.jb, stackp); +#else + UPD_STACK_JB(thread->ctx.jb, stackp - 16); +#endif SET_RETURN_ADDR_JB(thread->ctx.jb, _thread_sig_wrapper); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message