From owner-p4-projects Fri Jun 14 13:39:22 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7E7F437B404; Fri, 14 Jun 2002 13:39:07 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 8615B37B432 for ; Fri, 14 Jun 2002 13:39:06 -0700 (PDT) Received: (from perforce@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g5EKd6t52939 for perforce@freebsd.org; Fri, 14 Jun 2002 13:39:06 -0700 (PDT) (envelope-from julian@freebsd.org) Date: Fri, 14 Jun 2002 13:39:06 -0700 (PDT) Message-Id: <200206142039.g5EKd6t52939@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to julian@freebsd.org using -f From: Julian Elischer Subject: PERFORCE change 12939 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=12939 Change 12939 by julian@julian_ref on 2002/06/14 13:38:57 try make the test program compile Affected files ... ... //depot/projects/kse/bin/ksetest/kse_threads_test.c#7 edit ... //depot/projects/kse/sys/sys/kse.h#11 edit Differences ... ==== //depot/projects/kse/bin/ksetest/kse_threads_test.c#7 (text+ko) ==== @@ -19,7 +19,7 @@ }; struct per_kse { - struct kse_mailbox *mbox; + struct kse_mailbox mbox; struct user_thread *curthread; }; /************************************************************* @@ -52,7 +52,7 @@ /************************************************************* * Globals **************************************************************/ -struct per_kse first_kse; /* for NOW cheat and make it global */ +struct per_kse *first_kse; /* for NOW cheat and make it global */ TAILQ_HEAD(, user_thread) runqueue = TAILQ_HEAD_INITIALIZER(runqueue); /************************************************************* * Implementation parameters @@ -87,30 +87,21 @@ * and there-after, returned to by the upcall many times. **************************************************************/ void -UTS(struct _jmp_buf *jb1, struct per_kse *ksedata, int newgroup) +UTS(struct kse_mailbox *ke_mbox) { - struct kse_mailbox ke_mbox; struct user_thread *thread; struct thread_mailbox *completed; + struct per_kse *ksedata = ke_mbox->kmbx_UTS_handle; int done = 0; - /* Let the caller know where our mailbox is */ - bzero(&ke_mbox, sizeof(ke_mbox)); - ksedata->mbox = &ke_mbox; - ke_mbox.UTS_handle = ksedata; - if( kse_new(&ke_mbox, newgroup)) { /* initial call returns */ - _longjmp(jb1, 1); /* go back to caller's stack and caller */ - /* NOTREACHED */ - } - /**********************************/ /* UTS upcall starts running here. */ /**********************************/ /**********************************/ /* If there are returned syscall threads, put them on the run queue */ - if ((completed = ke_mbox.completed_threads)) { - ke_mbox.completed_threads = NULL; + if ((completed = ke_mbox->kmbx_completed_threads)) { + ke_mbox->kmbx_completed_threads = NULL; while (completed) { thread = completed->UTS_handle; completed = completed->next_completed; @@ -121,7 +112,7 @@ /* find highest priority thread and load it */ if ((thread = select_thread())) { ksedata->curthread = thread; - ke_mbox.current_thread = &thread->mbox; + ke_mbox->kmbx_current_thread = &thread->mbox; /* loads context similar to longjmp() */ loadthread(&thread->mbox.ctx.tfrm.tf_tf); @@ -141,22 +132,19 @@ jmp_buf jb1; jmp_buf jb2; struct kse_mailbox *mboxaddr; - int i; + struct per_kse *user_UTS_info; + int err; newstack = malloc(K_STACKSIZE); - if (_setjmp(jb1) == 0) { - if (_setjmp(jb2) == 0) { - jb2[0]._jb[2] = (int)&newstack[K_STACKSIZE - 16]; - _longjmp(jb2, 1); - } - /* running with a different SP */ - { - /* Get all the rest set up. */ - UTS(&jb1[0], ksedata, newgroup); - /* NOTREACHED */ - } - } - return(0); + user_UTS_info = malloc(sizeof (struct per_kse)); + bzero(user_UTS_info, sizeof (struct per_kse)); + mboxaddr = &user_UTS_info->mbox; + mboxaddr->kmbx_stackbase = newstack; + mboxaddr->kmbx_stacksize = K_STACKSIZE; + mboxaddr->kmbx_upcall = &UTS; + mboxaddr->kmbx_UTS_handle = newstack; + err = kse_new(mboxaddr, newgroup); + return(err); } @@ -264,10 +252,10 @@ runq_insert( makethread(&thread2_code, 0, NULL)); /* and one which we will run ourself */ - first_kse.curthread = makethread(&thread3_code, 0, NULL); + first_kse->curthread = makethread(&thread3_code, 0, NULL); /* start two KSEs in different KSEGRPs */ - if (startkse(&first_kse)) { + if (startkse(first_kse)) { perror("failed to start KSE"); exit(1); } @@ -277,7 +265,7 @@ /* we are a thread, start the ball rolling */ /* let the kernel know we are it */ - first_kse.mbox->current_thread = &first_kse.curthread->mbox; + first_kse->mbox.kmbx_current_thread = &first_kse->curthread->mbox; thread3_code(NULL); return 0; } ==== //depot/projects/kse/sys/sys/kse.h#11 (text+ko) ==== @@ -32,6 +32,7 @@ #ifndef SYS_KSE_H #define SYS_KSE_H +#define _KERNEL #include /* * This file defines the structures needed for communication between @@ -59,8 +60,10 @@ */ struct kse_mailbox { + /*void (*kmbx_upcall)(struct kse_mailbox *mbx); */ kse_fn_t *kmbx_upcall; - caddr_t kmbx_stackbase; +int x; + char *kmbx_stackbase; unsigned long int kmbx_stacksize; struct thread_mailbox *kmbx_current_thread; struct thread_mailbox *kmbx_completed_threads; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message