From owner-svn-src-all@FreeBSD.ORG Tue Mar 15 06:43:40 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA3F21065676; Tue, 15 Mar 2011 06:43:40 +0000 (UTC) (envelope-from dchagin@dchagin.static.corbina.ru) Received: from contrabass.corbina.net (contrabass.post.ru [85.21.78.5]) by mx1.freebsd.org (Postfix) with ESMTP id 2B9498FC14; Tue, 15 Mar 2011 06:43:39 +0000 (UTC) Received: from corbina.ru (mail.post.ru [195.14.50.16]) by contrabass.corbina.net (Postfix) with ESMTP id 96F34CB386; Tue, 15 Mar 2011 09:43:36 +0300 (MSK) X-Virus-Scanned: by cgpav Uf39PSi9pFi9oFi9 Received: from [10.208.22.99] (HELO dchagin.static.corbina.ru) by corbina.ru (CommuniGate Pro SMTP 5.1.14) with ESMTPS id 308500732; Tue, 15 Mar 2011 09:43:36 +0300 Received: from dchagin.static.corbina.ru (localhost [127.0.0.1]) by dchagin.static.corbina.ru (8.14.4/8.14.4) with ESMTP id p2F6haPo004026; Tue, 15 Mar 2011 09:43:36 +0300 (MSK) (envelope-from dchagin@dchagin.static.corbina.ru) Received: (from dchagin@localhost) by dchagin.static.corbina.ru (8.14.4/8.14.4/Submit) id p2F6hVj6004025; Tue, 15 Mar 2011 09:43:31 +0300 (MSK) (envelope-from dchagin) Date: Tue, 15 Mar 2011 09:43:30 +0300 From: Chagin Dmitry To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <20110315064330.GA4015@dchagin.static.corbina.ru> References: <201103131458.p2DEw2xG057948@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7AUc2qLy4jB3hD7Z" Content-Disposition: inline In-Reply-To: <201103131458.p2DEw2xG057948@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Subject: Re: svn commit: r219609 - in head/sys: amd64/linux32 i386/linux X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Mar 2011 06:43:41 -0000 --7AUc2qLy4jB3hD7Z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Mar 13, 2011 at 02:58:02PM +0000, Dmitry Chagin wrote: > Author: dchagin > Date: Sun Mar 13 14:58:02 2011 > New Revision: 219609 > URL: http://svn.freebsd.org/changeset/base/219609 >=20 > Log: > Enable shared page use for amd64/linux32 and i386/linux binaries. > Move signal trampoline code from the top of the stack to the shared pag= e. > =20 > MFC after: 2 Weeks Describe the reasons for this change in more detail: Instead of installing the signal trampoline at every exec() time copy it only once when the module loads. Requested by: netchild@ >=20 > Modified: > head/sys/amd64/linux32/linux.h > head/sys/amd64/linux32/linux32_sysvec.c > head/sys/i386/linux/linux.h > head/sys/i386/linux/linux_sysvec.c >=20 > Modified: head/sys/amd64/linux32/linux.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/amd64/linux32/linux.h Sun Mar 13 13:42:43 2011 (r219608) > +++ head/sys/amd64/linux32/linux.h Sun Mar 13 14:58:02 2011 (r219609) > @@ -47,7 +47,10 @@ extern u_char linux_debug_map[]; > MALLOC_DECLARE(M_LINUX); > #endif > =20 > -#define LINUX32_USRSTACK ((1ul << 32) - PAGE_SIZE) > +#define LINUX32_MAXUSER ((1ul << 32) - PAGE_SIZE) > +#define LINUX32_SHAREDPAGE (LINUX32_MAXUSER - PAGE_SIZE) > +#define LINUX32_USRSTACK LINUX32_SHAREDPAGE > + > /* XXX 16 =3D sizeof(linux32_ps_strings) */ > #define LINUX32_PS_STRINGS (LINUX32_USRSTACK - 16) > #define LINUX32_MAXDSIZ (512 * 1024 * 1024) /* 512MB */ >=20 > Modified: head/sys/amd64/linux32/linux32_sysvec.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/amd64/linux32/linux32_sysvec.c Sun Mar 13 13:42:43 2011 (r21= 9608) > +++ head/sys/amd64/linux32/linux32_sysvec.c Sun Mar 13 14:58:02 2011 (r21= 9609) > @@ -411,8 +411,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo > * Build context to run handler in. > */ > regs->tf_rsp =3D PTROUT(fp); > - regs->tf_rip =3D LINUX32_PS_STRINGS - *(p->p_sysent->sv_szsigcode) + > - linux_sznonrtsigcode; > + regs->tf_rip =3D p->p_sysent->sv_sigcode_base + linux_sznonrtsigcode; > regs->tf_rflags &=3D ~(PSL_T | PSL_D); > regs->tf_cs =3D _ucode32sel; > regs->tf_ss =3D _udatasel; > @@ -535,7 +534,7 @@ linux_sendsig(sig_t catcher, ksiginfo_t=20 > * Build context to run handler in. > */ > regs->tf_rsp =3D PTROUT(fp); > - regs->tf_rip =3D LINUX32_PS_STRINGS - *(p->p_sysent->sv_szsigcode); > + regs->tf_rip =3D p->p_sysent->sv_sigcode_base; > regs->tf_rflags &=3D ~(PSL_T | PSL_D); > regs->tf_cs =3D _ucode32sel; > regs->tf_ss =3D _udatasel; > @@ -890,21 +889,15 @@ linux_copyout_strings(struct image_param > * Also deal with signal trampoline code for this exec type. > */ > arginfo =3D (struct linux32_ps_strings *)LINUX32_PS_STRINGS; > - destp =3D (caddr_t)arginfo - linux_szsigcode - SPARE_USRSPACE - > - linux_szplatform - roundup((ARG_MAX - imgp->args->stringspace), > + destp =3D (caddr_t)arginfo - SPARE_USRSPACE - linux_szplatform - > + roundup((ARG_MAX - imgp->args->stringspace), > sizeof(char *)); > =20 > /* > - * install sigcode > - */ > - copyout(imgp->proc->p_sysent->sv_sigcode, > - ((caddr_t)arginfo - linux_szsigcode), linux_szsigcode); > - > - /* > * Install LINUX_PLATFORM > */ > - copyout(linux_platform, ((caddr_t)arginfo - linux_szsigcode - > - linux_szplatform), linux_szplatform); > + copyout(linux_platform, ((caddr_t)arginfo - linux_szplatform), > + linux_szplatform); > =20 > /* > * If we have a valid auxargs ptr, prepare some room > @@ -1050,7 +1043,7 @@ struct sysentvec elf_linux_sysvec =3D { > .sv_minsigstksz =3D LINUX_MINSIGSTKSZ, > .sv_pagesize =3D PAGE_SIZE, > .sv_minuser =3D VM_MIN_ADDRESS, > - .sv_maxuser =3D LINUX32_USRSTACK, > + .sv_maxuser =3D LINUX32_MAXUSER, > .sv_usrstack =3D LINUX32_USRSTACK, > .sv_psstrings =3D LINUX32_PS_STRINGS, > .sv_stackprot =3D VM_PROT_ALL, > @@ -1058,12 +1051,15 @@ struct sysentvec elf_linux_sysvec =3D { > .sv_setregs =3D exec_linux_setregs, > .sv_fixlimit =3D linux32_fixlimit, > .sv_maxssiz =3D &linux32_maxssiz, > - .sv_flags =3D SV_ABI_LINUX | SV_ILP32 | SV_IA32, > + .sv_flags =3D SV_ABI_LINUX | SV_ILP32 | SV_IA32 | SV_SHP, > .sv_set_syscall_retval =3D cpu_set_syscall_retval, > .sv_fetch_syscall_args =3D linux32_fetch_syscall_args, > .sv_syscallnames =3D NULL, > + .sv_shared_page_base =3D LINUX32_SHAREDPAGE, > + .sv_shared_page_len =3D PAGE_SIZE, > .sv_schedtail =3D linux_schedtail, > }; > +INIT_SYSENTVEC(elf_sysvec, &elf_linux_sysvec); > =20 > static char GNU_ABI_VENDOR[] =3D "GNU"; > static int GNULINUX_ABI_DESC =3D 0; >=20 > Modified: head/sys/i386/linux/linux.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/i386/linux/linux.h Sun Mar 13 13:42:43 2011 (r219608) > +++ head/sys/i386/linux/linux.h Sun Mar 13 14:58:02 2011 (r219609) > @@ -47,6 +47,9 @@ extern u_char linux_debug_map[]; > MALLOC_DECLARE(M_LINUX); > #endif > =20 > +#define LINUX_SHAREDPAGE (VM_MAXUSER_ADDRESS - PAGE_SIZE) > +#define LINUX_USRSTACK LINUX_SHAREDPAGE > + > #define PTRIN(v) (void *)(v) > #define PTROUT(v) (l_uintptr_t)(v) > =20 >=20 > Modified: head/sys/i386/linux/linux_sysvec.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/i386/linux/linux_sysvec.c Sun Mar 13 13:42:43 2011 (r219608) > +++ head/sys/i386/linux/linux_sysvec.c Sun Mar 13 14:58:02 2011 (r219609) > @@ -90,6 +90,8 @@ MALLOC_DEFINE(M_LINUX, "linux", "Linux m > #define LINUX_SYS_linux_rt_sendsig 0 > #define LINUX_SYS_linux_sendsig 0 > =20 > +#define LINUX_PS_STRINGS (LINUX_USRSTACK - sizeof(struct ps_strings)) > + > extern char linux_sigcode[]; > extern int linux_szsigcode; > =20 > @@ -308,21 +310,14 @@ linux_copyout_strings(struct image_param > */ > p =3D imgp->proc; > arginfo =3D (struct ps_strings *)p->p_sysent->sv_psstrings; > - destp =3D (caddr_t)arginfo - linux_szsigcode - SPARE_USRSPACE - > - linux_szplatform - roundup((ARG_MAX - imgp->args->stringspace), > - sizeof(char *)); > - > - /* > - * install sigcode > - */ > - copyout(p->p_sysent->sv_sigcode, ((caddr_t)arginfo - > - linux_szsigcode), linux_szsigcode); > + destp =3D (caddr_t)arginfo - SPARE_USRSPACE - linux_szplatform - > + roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *)); > =20 > /* > * install LINUX_PLATFORM > */ > - copyout(linux_platform, ((caddr_t)arginfo - linux_szsigcode - > - linux_szplatform), linux_szplatform); > + copyout(linux_platform, ((caddr_t)arginfo - linux_szplatform), > + linux_szplatform); > =20 > /* > * If we have a valid auxargs ptr, prepare some room > @@ -520,8 +515,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo > * Build context to run handler in. > */ > regs->tf_esp =3D (int)fp; > - regs->tf_eip =3D PS_STRINGS - *(p->p_sysent->sv_szsigcode) + > - linux_sznonrtsigcode; > + regs->tf_eip =3D p->p_sysent->sv_sigcode_base + linux_sznonrtsigcode; > regs->tf_eflags &=3D ~(PSL_T | PSL_VM | PSL_D); > regs->tf_cs =3D _ucodesel; > regs->tf_ds =3D _udatasel; > @@ -640,7 +634,7 @@ linux_sendsig(sig_t catcher, ksiginfo_t=20 > * Build context to run handler in. > */ > regs->tf_esp =3D (int)fp; > - regs->tf_eip =3D PS_STRINGS - *(p->p_sysent->sv_szsigcode); > + regs->tf_eip =3D p->p_sysent->sv_sigcode_base; > regs->tf_eflags &=3D ~(PSL_T | PSL_VM | PSL_D); > regs->tf_cs =3D _ucodesel; > regs->tf_ds =3D _udatasel; > @@ -986,7 +980,7 @@ struct sysentvec linux_sysvec =3D { > .sv_pagesize =3D PAGE_SIZE, > .sv_minuser =3D VM_MIN_ADDRESS, > .sv_maxuser =3D VM_MAXUSER_ADDRESS, > - .sv_usrstack =3D USRSTACK, > + .sv_usrstack =3D LINUX_USRSTACK, > .sv_psstrings =3D PS_STRINGS, > .sv_stackprot =3D VM_PROT_ALL, > .sv_copyout_strings =3D exec_copyout_strings, > @@ -997,8 +991,11 @@ struct sysentvec linux_sysvec =3D { > .sv_set_syscall_retval =3D cpu_set_syscall_retval, > .sv_fetch_syscall_args =3D linux_fetch_syscall_args, > .sv_syscallnames =3D NULL, > + .sv_shared_page_base =3D LINUX_SHAREDPAGE, > + .sv_shared_page_len =3D PAGE_SIZE, > .sv_schedtail =3D linux_schedtail, > }; > +INIT_SYSENTVEC(aout_sysvec, &linux_sysvec); > =20 > struct sysentvec elf_linux_sysvec =3D { > .sv_size =3D LINUX_SYS_MAXSYSCALL, > @@ -1021,19 +1018,22 @@ struct sysentvec elf_linux_sysvec =3D { > .sv_pagesize =3D PAGE_SIZE, > .sv_minuser =3D VM_MIN_ADDRESS, > .sv_maxuser =3D VM_MAXUSER_ADDRESS, > - .sv_usrstack =3D USRSTACK, > - .sv_psstrings =3D PS_STRINGS, > + .sv_usrstack =3D LINUX_USRSTACK, > + .sv_psstrings =3D LINUX_PS_STRINGS, > .sv_stackprot =3D VM_PROT_ALL, > .sv_copyout_strings =3D linux_copyout_strings, > .sv_setregs =3D exec_linux_setregs, > .sv_fixlimit =3D NULL, > .sv_maxssiz =3D NULL, > - .sv_flags =3D SV_ABI_LINUX | SV_IA32 | SV_ILP32, > + .sv_flags =3D SV_ABI_LINUX | SV_IA32 | SV_ILP32 | SV_SHP, > .sv_set_syscall_retval =3D cpu_set_syscall_retval, > .sv_fetch_syscall_args =3D linux_fetch_syscall_args, > .sv_syscallnames =3D NULL, > + .sv_shared_page_base =3D LINUX_SHAREDPAGE, > + .sv_shared_page_len =3D PAGE_SIZE, > .sv_schedtail =3D linux_schedtail, > }; > +INIT_SYSENTVEC(elf_sysvec, &elf_linux_sysvec); > =20 > static char GNU_ABI_VENDOR[] =3D "GNU"; > static int GNULINUX_ABI_DESC =3D 0; --=20 Have fun! chd --7AUc2qLy4jB3hD7Z Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iEYEARECAAYFAk1/CpIACgkQ0t2Tb3OO/O3aJgCg0YdMSfo95tx7kJvvnZF1YvdL AzIAnRo6WmMmCu4RdNKV9f5K1NxA4/DJ =lCPG -----END PGP SIGNATURE----- --7AUc2qLy4jB3hD7Z--