Date: Thu, 6 Jul 2006 07:44:54 -0400 From: John Baldwin <jhb@freebsd.org> To: Roman Divacky <rdivacky@freebsd.org> Cc: Perforce Change Reviews <perforce@freebsd.org> Subject: Re: PERFORCE change 100719 for review Message-ID: <200607060744.55037.jhb@freebsd.org> In-Reply-To: <200607061105.k66B5JKG065286@repoman.freebsd.org> References: <200607061105.k66B5JKG065286@repoman.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <machine/cpu.h> > #include <machine/pcb.h> > > +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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200607060744.55037.jhb>