From owner-p4-projects@FreeBSD.ORG Thu Jul 6 11:47:41 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 16A2B16A5EB; Thu, 6 Jul 2006 11:47:41 +0000 (UTC) X-Original-To: perforce@freebsd.org 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 B625316A5E7; Thu, 6 Jul 2006 11:47:40 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0A12443D55; Thu, 6 Jul 2006 11:47:39 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from zion.baldwin.cx (zion.baldwin.cx [192.168.0.7]) (authenticated bits=0) by server.baldwin.cx (8.13.4/8.13.4) with ESMTP id k66BlZ8s008534; Thu, 6 Jul 2006 07:47:38 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: Roman Divacky Date: Thu, 6 Jul 2006 07:44:54 -0400 User-Agent: KMail/1.9.1 References: <200607061105.k66B5JKG065286@repoman.freebsd.org> In-Reply-To: <200607061105.k66B5JKG065286@repoman.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200607060744.55037.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [192.168.0.1]); Thu, 06 Jul 2006 07:47:38 -0400 (EDT) X-Virus-Scanned: ClamAV 0.87.1/1586/Wed Jul 5 15:22:07 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on server.baldwin.cx Cc: Perforce Change Reviews Subject: Re: PERFORCE change 100719 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jul 2006 11:47:41 -0000 On Thursday 06 July 2006 07:05, Roman Divacky wrote: > http://perforce.freebsd.org/chv.cgi?CH=100719 > > Change 100719 by rdivacky@rdivacky_witten on 2006/07/06 11:04:26 > > TID handling > o introduction of P_LINUX proc flag > o introduction of linux hooks into exit1() and userret() > o TID handling in i386 version of linuxolator > > this has not been tested much. More testing will come once the futexes are finished. > > Affected files ... > > .. //depot/projects/soc2006/rdivacky_linuxolator/i386/linux/linux_dummy.c#5 edit > .. //depot/projects/soc2006/rdivacky_linuxolator/i386/linux/linux_machdep.c#7 edit > .. //depot/projects/soc2006/rdivacky_linuxolator/i386/linux/linux_proto.h#8 edit > .. //depot/projects/soc2006/rdivacky_linuxolator/i386/linux/linux_syscall.h#8 edit > .. //depot/projects/soc2006/rdivacky_linuxolator/i386/linux/linux_sysent.c#8 edit > .. //depot/projects/soc2006/rdivacky_linuxolator/i386/linux/linux_sysvec.c#5 edit > .. //depot/projects/soc2006/rdivacky_linuxolator/i386/linux/syscalls.master#8 edit > .. //depot/projects/soc2006/rdivacky_linuxolator/kern/kern_exit.c#3 edit > .. //depot/projects/soc2006/rdivacky_linuxolator/kern/subr_trap.c#2 edit > .. //depot/projects/soc2006/rdivacky_linuxolator/sys/proc.h#2 edit > > Differences ... > > ==== //depot/projects/soc2006/rdivacky_linuxolator/kern/kern_exit.c#3 (text+ko) ==== > > @@ -87,6 +87,7 @@ > > /* Hook for NFS teardown procedure. */ > void (*nlminfo_release_p)(struct proc *p); > +int (*linux_proc_exit_p)(struct thread *) = NULL; /* necessary for linuxolator */ > > /* > * exit -- > @@ -236,6 +237,9 @@ > */ > EVENTHANDLER_INVOKE(process_exit, p); > > + /* we have to call linux exit hook */ > + if (p->p_flag & P_LINUX && linux_proc_exit_p != NULL) > + (linux_proc_exit_p)(td); > MALLOC(p->p_ru, struct rusage *, sizeof(struct rusage), > M_ZOMBIE, M_WAITOK); > /* > Please use a 'process_exit' eventhandler instead. You can test P_LINUX in your handler and return right away for non-Linux procs. > ==== //depot/projects/soc2006/rdivacky_linuxolator/kern/subr_trap.c#2 (text+ko) ==== > > @@ -67,6 +67,8 @@ > #include > #include > > +int (*linux_userret_p)(struct thread *) = NULL; /* for linuxolator */ > + > /* > * Define the code needed before returning to user mode, for > * trap and syscall. > @@ -128,6 +130,10 @@ > addupc_task(td, TRAPF_PC(frame), td->td_pticks * psratio); > } > > + /* linux userret */ > + if (p->p_flag & P_LINUX && linux_userret_p != NULL) > + (linux_userret_p)(td); > + > /* > * Let the scheduler adjust our priority etc. > */ > If it is needed we can add a new 'thread_userret' eventhandler rather than putting Linux-specific hooks into the code. > ==== //depot/projects/soc2006/rdivacky_linuxolator/sys/proc.h#2 (text+ko) ==== > > @@ -655,6 +655,7 @@ > #define P_HWPMC 0x800000 /* Process is using HWPMCs */ > > #define P_JAILED 0x1000000 /* Process is in jail. */ > +#define P_LINUX 0x2000000 /* linux binary */ > #define P_INEXEC 0x4000000 /* Process is in execve(). */ > #define P_STATCHILD 0x8000000 /* Child process stopped or exited. */ If you do the two above, then you might be able to come up with another test (compare p_sysvec?) instead of needing this flag since the only tests of it would be in the emulator code itself. -- John Baldwin