From owner-svn-src-head@FreeBSD.ORG Tue Nov 18 06:15:11 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A1AD1065672; Tue, 18 Nov 2008 06:15:11 +0000 (UTC) (envelope-from root@dchagin.dialup.corbina.ru) Received: from contrabass.post.ru (contrabass.post.ru [85.21.78.5]) by mx1.freebsd.org (Postfix) with ESMTP id 8CF978FC18; Tue, 18 Nov 2008 06:15:10 +0000 (UTC) (envelope-from root@dchagin.dialup.corbina.ru) Received: from corbina.ru (mail.post.ru [195.14.50.16]) by contrabass.post.ru (Postfix) with ESMTP id 2A49121BD6; Tue, 18 Nov 2008 09:15:07 +0300 (MSK) X-Virus-Scanned: by cgpav Uf39PSi9pFi9oFi9 Received: from dchagin.dialup.corbina.ru ([78.107.232.239] verified) by corbina.ru (CommuniGate Pro SMTP 5.1.14) with ESMTPS id 1464477105; Tue, 18 Nov 2008 09:15:07 +0300 Received: from dchagin.dialup.corbina.ru (localhost.chd.net [127.0.0.1]) by dchagin.dialup.corbina.ru (8.14.3/8.14.3) with ESMTP id mAI6F6jb001642; Tue, 18 Nov 2008 09:15:06 +0300 (MSK) (envelope-from root@dchagin.dialup.corbina.ru) Received: (from root@localhost) by dchagin.dialup.corbina.ru (8.14.3/8.14.3/Submit) id mAI6F34G001641; Tue, 18 Nov 2008 09:15:03 +0300 (MSK) (envelope-from root) Date: Tue, 18 Nov 2008 09:15:03 +0300 From: Chagin Dmitry To: Kostik Belousov Message-ID: <20081118061503.GA1596@dchagin.dialup.corbina.ru> References: <200811170237.mAH2bjY5088186@ambrisko.com> <200811171211.42740.jhb@freebsd.org> <20081117193541.GG90129@deviant.kiev.zoral.com.ua> <200811171613.36602.jhb@freebsd.org> <20081117224048.GN90129@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20081117224048.GN90129@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: Doug Ambrisko , src-committers@freebsd.org, Doug Ambrisko , Peter Wemm , John Baldwin , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r184974 - head/sys/dev/mfi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 06:15:11 -0000 On Tue, Nov 18, 2008 at 12:40:48AM +0200, Kostik Belousov wrote: > On Mon, Nov 17, 2008 at 01:21:53PM -0800, Peter Wemm wrote: > > On Mon, Nov 17, 2008 at 1:13 PM, John Baldwin wrote: > > >> > > >> Ok, what about the following. I only compiled it on i386/amd64. And, > > >> there are more places to convert to such checks, for sure. > > >> > > >> [yummy patch] > > > > > > Commit! Note that this is not MFC'able due to ABI breakage for older linux.ko > > > modules, but this is the proper solution for 8.0+. > I do not think that sysent KBI shall be preserved on the stable branch, > it is too core functionality. Our KBI guarantee mostly center around > drivers and less so for filesystem modules. > > linux or any other ABI emulator probably do not deserve KBI stability > guarantee, IMHO. > > Anyway, I do not insist. > > > > > > > -- > > > John Baldwin > > > > > > > > > I was thinking of suggesting a macro to replace the verbose test if > > curproc->td_proc->p_sysent->sv_flags, but I couldn't think of > > something off the top of my head. > > > > - if (curthread->td_proc->p_sysent == > > &ia32_freebsd_sysvec) { > > + if (curthread->td_proc->p_sysent->sv_flags & SV_ILP32) { > > > > if (SV_FLAGS(curthread) & SV_ILP32) ... or the like. I'm not set on > > this, it just seemed like it might be worth mentioning. > > > > Also, change curthread->td_proc with curproc, for what its worth. > Did it. > > I discussed the change with Dmitry Chagin, and he wants explicit mark > of the image ABI, for linux64/amd64 work. > thnx! tested at dchagin# uname -a FreeBSD dchagin.dialup.corbina.ru 8.0-CURRENT FreeBSD 8.0-CURRENT #28 r185047: T ue Nov 18 08:55:27 MSK 2008 root@dchagin.dialup.corbina.ru:/usr/obj/usr/loca l/root/pub/head/sys/YOY amd64 > diff --git a/sys/amd64/amd64/elf_machdep.c b/sys/amd64/amd64/elf_machdep.c > index ec1afc7..4f6d178 100644 > --- a/sys/amd64/amd64/elf_machdep.c > +++ b/sys/amd64/amd64/elf_machdep.c > @@ -72,7 +72,8 @@ struct sysentvec elf64_freebsd_sysvec = { > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_setregs, > .sv_fixlimit = NULL, > - .sv_maxssiz = NULL > + .sv_maxssiz = NULL, > + .sv_flags = SV_ABI_FREEBSD | SV_LP64 > }; > > static Elf64_Brandinfo freebsd_brand_info = { > diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c > index e233700..3acee30 100644 > --- a/sys/amd64/linux32/linux32_sysvec.c > +++ b/sys/amd64/linux32/linux32_sysvec.c > @@ -1026,6 +1026,7 @@ struct sysentvec elf_linux_sysvec = { > .sv_setregs = exec_linux_setregs, > .sv_fixlimit = linux32_fixlimit, > .sv_maxssiz = &linux32_maxssiz, > + .sv_flags = SV_ABI_LINUX | SV_ILP32 | SV_IA32 > }; > > static Elf32_Brandinfo linux_brand = { > diff --git a/sys/arm/arm/elf_machdep.c b/sys/arm/arm/elf_machdep.c > index f44a622..693eab1 100644 > --- a/sys/arm/arm/elf_machdep.c > +++ b/sys/arm/arm/elf_machdep.c > @@ -72,7 +72,8 @@ struct sysentvec elf32_freebsd_sysvec = { > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_setregs, > .sv_fixlimit = NULL, > - .sv_maxssiz = NULL > + .sv_maxssiz = NULL, > + .sv_flags = SV_ABI_FREEBSD | SV_ILP32 > }; > > static Elf32_Brandinfo freebsd_brand_info = { > diff --git a/sys/compat/ia32/ia32_sysvec.c b/sys/compat/ia32/ia32_sysvec.c > index ef74ba0..0b32b9a 100644 > --- a/sys/compat/ia32/ia32_sysvec.c > +++ b/sys/compat/ia32/ia32_sysvec.c > @@ -135,7 +135,8 @@ struct sysentvec ia32_freebsd_sysvec = { > .sv_copyout_strings = ia32_copyout_strings, > .sv_setregs = ia32_setregs, > .sv_fixlimit = ia32_fixlimit, > - .sv_maxssiz = &ia32_maxssiz > + .sv_maxssiz = &ia32_maxssiz, > + .sv_flags = SV_ABI_FREEBSD | SV_IA32 | SV_ILP32 > }; > > > diff --git a/sys/compat/svr4/svr4_sysvec.c b/sys/compat/svr4/svr4_sysvec.c > index 60cca7b..63e8e54 100644 > --- a/sys/compat/svr4/svr4_sysvec.c > +++ b/sys/compat/svr4/svr4_sysvec.c > @@ -190,7 +190,8 @@ struct sysentvec svr4_sysvec = { > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_setregs, > .sv_fixlimit = NULL, > - .sv_maxssiz = NULL > + .sv_maxssiz = NULL, > + .sv_flags = SV_ABI_UNDEF | SV_IA32 | SV_ILP32 > }; > > const char svr4_emul_path[] = "/compat/svr4"; > diff --git a/sys/i386/i386/elf_machdep.c b/sys/i386/i386/elf_machdep.c > index 93f1d45..19eddd0 100644 > --- a/sys/i386/i386/elf_machdep.c > +++ b/sys/i386/i386/elf_machdep.c > @@ -72,7 +72,8 @@ struct sysentvec elf32_freebsd_sysvec = { > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_setregs, > .sv_fixlimit = NULL, > - .sv_maxssiz = NULL > + .sv_maxssiz = NULL, > + .sv_flags = SV_ABI_FREEBSD | SV_IA32 | SV_ILP32 > }; > > static Elf32_Brandinfo freebsd_brand_info = { > diff --git a/sys/i386/ibcs2/ibcs2_sysvec.c b/sys/i386/ibcs2/ibcs2_sysvec.c > index 2c834dd..9112ed7 100644 > --- a/sys/i386/ibcs2/ibcs2_sysvec.c > +++ b/sys/i386/ibcs2/ibcs2_sysvec.c > @@ -85,7 +85,8 @@ struct sysentvec ibcs2_svr3_sysvec = { > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_setregs, > .sv_fixlimit = NULL, > - .sv_maxssiz = NULL > + .sv_maxssiz = NULL, > + .sv_flags = SV_ABI_UNDEF | SV_IA32 | SV_ILP32 > }; > > static int > diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c > index a3acfc9..7444901 100644 > --- a/sys/i386/linux/linux_sysvec.c > +++ b/sys/i386/linux/linux_sysvec.c > @@ -837,7 +837,8 @@ struct sysentvec linux_sysvec = { > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_linux_setregs, > .sv_fixlimit = NULL, > - .sv_maxssiz = NULL > + .sv_maxssiz = NULL, > + .sv_flags = SV_ABI_LINUX | SV_AOUT | SV_IA32 | SV_ILP32 > }; > > struct sysentvec elf_linux_sysvec = { > @@ -867,7 +868,8 @@ struct sysentvec elf_linux_sysvec = { > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_linux_setregs, > .sv_fixlimit = NULL, > - .sv_maxssiz = NULL > + .sv_maxssiz = NULL, > + .sv_flags = SV_ABI_LINUX | SV_IA32 | SV_ILP32 > }; > > static Elf32_Brandinfo linux_brand = { > diff --git a/sys/ia64/ia64/elf_machdep.c b/sys/ia64/ia64/elf_machdep.c > index 94f4cdc..a3a6e57 100644 > --- a/sys/ia64/ia64/elf_machdep.c > +++ b/sys/ia64/ia64/elf_machdep.c > @@ -80,7 +80,8 @@ struct sysentvec elf64_freebsd_sysvec = { > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_setregs, > .sv_fixlimit = NULL, > - .sv_maxssiz = NULL > + .sv_maxssiz = NULL, > + .sv_flags = SV_ABI_FREEBSD | SV_LP64 > }; > > static Elf64_Brandinfo freebsd_brand_info = { > diff --git a/sys/kern/imgact_aout.c b/sys/kern/imgact_aout.c > index f4e4614..6c2f627 100644 > --- a/sys/kern/imgact_aout.c > +++ b/sys/kern/imgact_aout.c > @@ -82,7 +82,13 @@ struct sysentvec aout_sysvec = { > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_setregs, > .sv_fixlimit = NULL, > - .sv_maxssiz = NULL > + .sv_maxssiz = NULL, > + .sv_flags = SV_ABI_FREEBSD | SV_AOUT | > +#if defined(__i386__) > + SV_IA32 | SV_ILP32 > +#else > +#error Choose SV_XXX flags for the platform > +#endif > }; > > static int > diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c > index dade1c2..3802259 100644 > --- a/sys/kern/kern_thr.c > +++ b/sys/kern/kern_thr.c > @@ -57,14 +57,12 @@ __FBSDID("$FreeBSD$"); > > #ifdef COMPAT_IA32 > > -extern struct sysentvec ia32_freebsd_sysvec; > - > static inline int > suword_lwpid(void *addr, lwpid_t lwpid) > { > int error; > > - if (curproc->p_sysent != &ia32_freebsd_sysvec) > + if (SV_CURPROC_FLAG(SV_LP64)) > error = suword(addr, lwpid); > else > error = suword32(addr, lwpid); > diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c > index eb587fb..9a7237d 100644 > --- a/sys/kern/uipc_socket.c > +++ b/sys/kern/uipc_socket.c > @@ -136,9 +136,8 @@ __FBSDID("$FreeBSD$"); > > #ifdef COMPAT_IA32 > #include > +#include > #include > - > -extern struct sysentvec ia32_freebsd_sysvec; > #endif > > static int soreceive_rcvoob(struct socket *so, struct uio *uio, > @@ -2277,7 +2276,7 @@ sosetopt(struct socket *so, struct sockopt *sopt) > case SO_SNDTIMEO: > case SO_RCVTIMEO: > #ifdef COMPAT_IA32 > - if (curthread->td_proc->p_sysent == &ia32_freebsd_sysvec) { > + if (SV_CURPROC_FLAG(SV_ILP32)) { > struct timeval32 tv32; > > error = sooptcopyin(sopt, &tv32, sizeof tv32, > @@ -2458,7 +2457,7 @@ integer: > tv.tv_sec = optval / hz; > tv.tv_usec = (optval % hz) * tick; > #ifdef COMPAT_IA32 > - if (curthread->td_proc->p_sysent == &ia32_freebsd_sysvec) { > + if (SV_CURPROC_FLAG(SV_ILP32)) { > struct timeval32 tv32; > > CP(tv, tv32, tv_sec); > diff --git a/sys/mips/mips/elf_machdep.c b/sys/mips/mips/elf_machdep.c > index 0234722..dc08bc2 100644 > --- a/sys/mips/mips/elf_machdep.c > +++ b/sys/mips/mips/elf_machdep.c > @@ -74,7 +74,8 @@ struct sysentvec elf32_freebsd_sysvec = { > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_setregs, > .sv_fixlimit = NULL, > - .sv_maxssiz = NULL > + .sv_maxssiz = NULL, > + .sv_flags = SV_ABI_FREEBSD | SV_ILP32 > }; > > static Elf32_Brandinfo freebsd_brand_info = { > diff --git a/sys/powerpc/powerpc/elf_machdep.c b/sys/powerpc/powerpc/elf_machdep.c > index dadf3ca..69ac55b 100644 > --- a/sys/powerpc/powerpc/elf_machdep.c > +++ b/sys/powerpc/powerpc/elf_machdep.c > @@ -75,7 +75,8 @@ struct sysentvec elf32_freebsd_sysvec = { > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_setregs, > .sv_fixlimit = NULL, > - .sv_maxssiz = NULL > + .sv_maxssiz = NULL, > + .sv_flags = SV_ABI_FREEBSD | SV_ILP32 > }; > > static Elf32_Brandinfo freebsd_brand_info = { > diff --git a/sys/sparc64/sparc64/elf_machdep.c b/sys/sparc64/sparc64/elf_machdep.c > index d1e610a..a956c5c 100644 > --- a/sys/sparc64/sparc64/elf_machdep.c > +++ b/sys/sparc64/sparc64/elf_machdep.c > @@ -87,7 +87,8 @@ static struct sysentvec elf64_freebsd_sysvec = { > .sv_copyout_strings = exec_copyout_strings, > .sv_setregs = exec_setregs, > .sv_fixlimit = NULL, > - .sv_maxssiz = NULL > + .sv_maxssiz = NULL, > + .sv_flags = SV_ABI_FREEBSD | SV_LP64 > }; > > static Elf64_Brandinfo freebsd_brand_info = { > diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h > index 0ec07a7..c068946 100644 > --- a/sys/sys/sysent.h > +++ b/sys/sys/sysent.h > @@ -100,8 +100,22 @@ struct sysentvec { > void (*sv_setregs)(struct thread *, u_long, u_long, u_long); > void (*sv_fixlimit)(struct rlimit *, int); > u_long *sv_maxssiz; > + u_int sv_flags; > }; > > +#define SV_ILP32 0x000100 > +#define SV_LP64 0x000200 > +#define SV_IA32 0x004000 > +#define SV_AOUT 0x008000 > + > +#define SV_ABI_MASK 0xff > +#define SV_CURPROC_FLAG(x) (curproc->p_sysent->sv_flags & (x)) > +#define SV_CURPROC_ABI() (curproc->p_sysent->sv_flags & SV_ABI_MASK) > +/* same as ELFOSABI_XXX, to prevent header pollution */ > +#define SV_ABI_LINUX 3 > +#define SV_ABI_FREEBSD 9 > +#define SV_ABI_UNDEF 255 > + > #ifdef _KERNEL > extern struct sysentvec aout_sysvec; > extern struct sysentvec elf_freebsd_sysvec; and what about target proc macro? -- Have fun! chd