From owner-freebsd-hackers Thu Jun 8 20:16:27 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from lor.watermarkgroup.com (lor.watermarkgroup.com [207.202.73.33]) by hub.freebsd.org (Postfix) with ESMTP id 724E937C107 for ; Thu, 8 Jun 2000 20:16:21 -0700 (PDT) (envelope-from luoqi@watermarkgroup.com) Received: (from luoqi@localhost) by lor.watermarkgroup.com (8.10.1/8.10.1) id e593GHC00794; Thu, 8 Jun 2000 23:16:17 -0400 (EDT) Date: Thu, 8 Jun 2000 23:16:17 -0400 (EDT) From: Luoqi Chen Message-Id: <200006090316.e593GHC00794@lor.watermarkgroup.com> To: freebsd-hackers@FreeBSD.ORG, miklic@ibm.net Subject: Re: Processes, context switching in kernel... Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > All, > > I'm working on the emulator for OSF1/Mach for FreeBSD/Alpha, and I need > some help understanding how to do some things in the FreeBSD kernel--if anyone > can answer any of the following questions, it would be greatly appreciated: > > 1) How do you create a process in the kernel (i.e., you fork in > user-space...what's the analogue for kernel-space)? > fork1(), see kern_fork.c > 2) How do you clone a process in kernel-space (i.e., in user-space, you would > fork and then share the entire process's memory space--how would you do such a > thing in kernel-space)? > fork1() with RFMEM flag. > 3) What needs to be done to perform a context switch (from within the kernel), > and are there any MP considerations when doing this? > Do the following, s = splhigh(); setrunqueue(p); p->p_stats->p_ru.ru_nivcsw++; mi_switch(); splx(s); nothing special for MP yet, but that's going to change soon... > 4) In what files do the proc and the u-area structures reside? > If you mean header files, they are and . > Thanks, > Andrew Miklic > -lq To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message