From owner-p4-projects Sun Sep 8 1:45:25 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8C0C037B401; Sun, 8 Sep 2002 01:45:16 -0700 (PDT) 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 1BB9737B400 for ; Sun, 8 Sep 2002 01:45:16 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id B05CA43E4A for ; Sun, 8 Sep 2002 01:45:15 -0700 (PDT) (envelope-from mini@freebsd.org) Received: from freefall.freebsd.org (perforce@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g888jFJU080531 for ; Sun, 8 Sep 2002 01:45:15 -0700 (PDT) (envelope-from mini@freebsd.org) Received: (from perforce@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g888jFsL080528 for perforce@freebsd.org; Sun, 8 Sep 2002 01:45:15 -0700 (PDT) Date: Sun, 8 Sep 2002 01:45:15 -0700 (PDT) Message-Id: <200209080845.g888jFsL080528@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to mini@freebsd.org using -f From: Jonathan Mini Subject: PERFORCE change 17228 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://people.freebsd.org/~peter/p4db/chv.cgi?CH=17228 Change 17228 by mini@mini_stylus on 2002/09/08 01:45:11 Use a thread_mailbox instead of a ucontext_t to store thread state. Affected files ... .. //depot/projects/kse/lib/libc_r/uthread/pthread_private.h#8 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_create.c#5 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_init.c#6 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_kern.c#7 edit Differences ... ==== //depot/projects/kse/lib/libc_r/uthread/pthread_private.h#8 (text+ko) ==== @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -511,7 +512,7 @@ /* * Machine context, including signal state. */ - ucontext_t ctx; + struct thread_mailbox mailbox; /* * Cancelability flags - the lower 2 bits are used by cancel ==== //depot/projects/kse/lib/libc_r/uthread/uthread_create.c#5 (text+ko) ==== @@ -50,7 +50,7 @@ int _thread_uniqueid_offset = OFF(uniqueid); int _thread_state_offset = OFF(state); int _thread_name_offset = OFF(name); -int _thread_ctx_offset = OFF(ctx); +int _thread_ctx_offset = OFF(mailbox.tm_context); #undef OFF int _thread_PS_RUNNING_value = PS_RUNNING; @@ -122,11 +122,13 @@ new_thread->magic = PTHREAD_MAGIC; /* Initialise the machine context: */ - getcontext(&new_thread->ctx); - new_thread->ctx.uc_stack.ss_sp = new_thread->stack; - new_thread->ctx.uc_stack.ss_size = + getcontext(&new_thread->mailbox.tm_context); + new_thread->mailbox.tm_context.uc_stack.ss_sp = new_thread->stack; + new_thread->mailbox.tm_context.uc_stack.ss_size = pattr->stacksize_attr; - makecontext(&new_thread->ctx, _thread_start, 1); + makecontext(&new_thread->mailbox.tm_context, + _thread_start, 1); + new_thread->mailbox.tm_udata = (void *)new_thread; /* Copy the thread attributes: */ memcpy(&new_thread->attr, pattr, sizeof(struct pthread_attr)); ==== //depot/projects/kse/lib/libc_r/uthread/uthread_init.c#6 (text+ko) ==== @@ -287,7 +287,7 @@ PTHREAD_CANCEL_DEFERRED; /* Setup the context for initial thread. */ - getcontext(&_thread_initial->ctx); + getcontext(&_thread_initial->mailbox.tm_context); _thread_kern_sched_ctx.uc_stack.ss_sp = _thread_initial->stack; _thread_kern_sched_ctx.uc_stack.ss_size = PTHREAD_STACK_INITIAL; ==== //depot/projects/kse/lib/libc_r/uthread/uthread_kern.c#7 (text+ko) ==== @@ -83,7 +83,7 @@ _thread_kern_in_sched = 1; /* Switch into the scheduler's context. */ - swapcontext(&curthread->ctx, &_thread_kern_sched_ctx); + swapcontext(&curthread->mailbox.tm_context, &_thread_kern_sched_ctx); DBG_MSG("Returned from swapcontext, thread %p\n", curthread); /* @@ -385,7 +385,8 @@ /* * Continue the thread at its current frame: */ - swapcontext(&_thread_kern_sched_ctx, &curthread->ctx); + swapcontext(&_thread_kern_sched_ctx, + &curthread->mailbox.tm_context); } } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message