diff options
author | dchagin <dchagin@FreeBSD.org> | 2016-01-09 15:48:11 +0000 |
---|---|---|
committer | dchagin <dchagin@FreeBSD.org> | 2016-01-09 15:48:11 +0000 |
commit | a034df74fdb12c279d0096abb6d6f7b2b2fec24b (patch) | |
tree | d94bd935147312dab2e67e6b9dfafa3f4041a20d | |
parent | 5c3e282c6e2de5e789d3037361681fa9796a395a (diff) | |
download | FreeBSD-src-a034df74fdb12c279d0096abb6d6f7b2b2fec24b.zip FreeBSD-src-a034df74fdb12c279d0096abb6d6f7b2b2fec24b.tar.gz |
MFC r283410:
Put linux_platform into the vdso to avoid copying it onto the stack at
every exec.
-rw-r--r-- | sys/amd64/linux32/linux32_locore.s | 6 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_sysvec.c | 25 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_vdso.lds.s | 1 | ||||
-rw-r--r-- | sys/compat/linux/linux_misc.c | 2 | ||||
-rw-r--r-- | sys/compat/linux/linux_misc.h | 2 | ||||
-rw-r--r-- | sys/i386/linux/linux_sysvec.c | 8 |
6 files changed, 22 insertions, 22 deletions
diff --git a/sys/amd64/linux32/linux32_locore.s b/sys/amd64/linux32/linux32_locore.s index 8a3b83e..7db3683 100644 --- a/sys/amd64/linux32/linux32_locore.s +++ b/sys/amd64/linux32/linux32_locore.s @@ -5,6 +5,12 @@ #include <amd64/linux32/linux32_syscall.h> /* system call numbers */ +.data + + .globl linux_platform +linux_platform: + .asciz "i686" + .text .code32 diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c index 5ceae58..0997065 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -110,8 +110,7 @@ MALLOC_DEFINE(M_LINUX, "linux", "Linux mode structures"); #define LINUX_SYS_linux_rt_sendsig 0 #define LINUX_SYS_linux_sendsig 0 -const char *linux_platform = "i686"; -static int linux_szplatform; +const char *linux_kplatform; static int linux_szsigcode; static vm_object_t linux_shared_page_obj; static char *linux_shared_page_mapping; @@ -229,6 +228,7 @@ struct linux32_ps_strings { LINUX_VDSO_SYM_INTPTR(linux32_sigcode); LINUX_VDSO_SYM_INTPTR(linux32_rt_sigcode); LINUX_VDSO_SYM_INTPTR(linux32_vsyscall); +LINUX_VDSO_SYM_CHAR(linux_platform); /* * If FreeBSD & Linux have a difference of opinion about what a trap @@ -257,11 +257,10 @@ elf_linux_fixup(register_t **stack_base, struct image_params *imgp) { Elf32_Auxargs *args; Elf32_Addr *base; - Elf32_Addr *pos, *uplatform; + Elf32_Addr *pos; struct linux32_ps_strings *arginfo; arginfo = (struct linux32_ps_strings *)LINUX32_PS_STRINGS; - uplatform = (Elf32_Addr *)((caddr_t)arginfo - linux_szplatform); KASSERT(curthread->td_proc == imgp->proc, ("unsafe elf_linux_fixup(), should be curproc")); @@ -296,7 +295,7 @@ elf_linux_fixup(register_t **stack_base, struct image_params *imgp) AUXARGS_ENTRY_32(pos, AT_EUID, imgp->proc->p_ucred->cr_svuid); AUXARGS_ENTRY_32(pos, AT_GID, imgp->proc->p_ucred->cr_rgid); AUXARGS_ENTRY_32(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid); - AUXARGS_ENTRY_32(pos, LINUX_AT_PLATFORM, PTROUT(uplatform)); + AUXARGS_ENTRY_32(pos, LINUX_AT_PLATFORM, PTROUT(linux_platform)); if (args->execfd != -1) AUXARGS_ENTRY_32(pos, AT_EXECFD, args->execfd); AUXARGS_ENTRY_32(pos, AT_NULL, 0); @@ -883,15 +882,8 @@ linux_copyout_strings(struct image_params *imgp) * Also deal with signal trampoline code for this exec type. */ arginfo = (struct linux32_ps_strings *)LINUX32_PS_STRINGS; - destp = (caddr_t)arginfo - SPARE_USRSPACE - linux_szplatform - - roundup((ARG_MAX - imgp->args->stringspace), - sizeof(char *)); - - /* - * Install LINUX_PLATFORM - */ - copyout(linux_platform, ((caddr_t)arginfo - linux_szplatform), - linux_szplatform); + destp = (caddr_t)arginfo - SPARE_USRSPACE - + roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *)); /* * If we have a valid auxargs ptr, prepare some room @@ -1075,6 +1067,9 @@ linux_vdso_install(void *param) bcopy(elf_linux_sysvec.sv_sigcode, linux_shared_page_mapping, linux_szsigcode); elf_linux_sysvec.sv_shared_page_obj = linux_shared_page_obj; + + linux_kplatform = linux_shared_page_mapping + + (linux_platform - (caddr_t)LINUX32_SHAREDPAGE); } SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_ANY, (sysinit_cfunc_t)linux_vdso_install, NULL); @@ -1181,8 +1176,6 @@ linux_elf_modevent(module_t mod, int type, void *data) linux_proc_exec, NULL, 1000); linux_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor, linux_thread_dtor, NULL, EVENTHANDLER_PRI_ANY); - linux_szplatform = roundup(strlen(linux_platform) + 1, - sizeof(char *)); linux_osd_jail_register(); stclohz = (stathz ? stathz : hz); if (bootverbose) diff --git a/sys/amd64/linux32/linux32_vdso.lds.s b/sys/amd64/linux32/linux32_vdso.lds.s index beaaef5..a49c209 100644 --- a/sys/amd64/linux32/linux32_vdso.lds.s +++ b/sys/amd64/linux32/linux32_vdso.lds.s @@ -60,6 +60,7 @@ VERSION linux32_vsyscall; linux32_sigcode; linux32_rt_sigcode; + linux_platform; local: *; }; } diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 21e5bfc..b1a583d 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -732,7 +732,7 @@ linux_newuname(struct thread *td, struct linux_newuname_args *args) *p = '\0'; break; } - strlcpy(utsname.machine, linux_platform, LINUX_MAX_UTSNAME); + strlcpy(utsname.machine, linux_kplatform, LINUX_MAX_UTSNAME); return (copyout(&utsname, args->buf, sizeof(utsname))); } diff --git a/sys/compat/linux/linux_misc.h b/sys/compat/linux/linux_misc.h index 1623422..2f2ead5 100644 --- a/sys/compat/linux/linux_misc.h +++ b/sys/compat/linux/linux_misc.h @@ -55,7 +55,7 @@ #define LINUX_MREMAP_MAYMOVE 1 #define LINUX_MREMAP_FIXED 2 -extern const char *linux_platform; +extern const char *linux_kplatform; /* * Non-standard aux entry types used in Linux ELF binaries. diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index 730e7ef..7c45200 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -118,7 +118,7 @@ static void linux_vdso_install(void *param); static void linux_vdso_deinstall(void *param); static int linux_szplatform; -const char *linux_platform; +const char *linux_kplatform; static eventhandler_tag linux_exit_tag; static eventhandler_tag linux_exec_tag; @@ -330,7 +330,7 @@ linux_copyout_strings(struct image_params *imgp) /* * install LINUX_PLATFORM */ - copyout(linux_platform, ((caddr_t)arginfo - linux_szplatform), + copyout(linux_kplatform, ((caddr_t)arginfo - linux_szplatform), linux_szplatform); /* @@ -1153,8 +1153,8 @@ linux_elf_modevent(module_t mod, int type, void *data) NULL, 1000); linux_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor, linux_thread_dtor, NULL, EVENTHANDLER_PRI_ANY); - linux_get_machine(&linux_platform); - linux_szplatform = roundup(strlen(linux_platform) + 1, + linux_get_machine(&linux_kplatform); + linux_szplatform = roundup(strlen(linux_kplatform) + 1, sizeof(char *)); linux_osd_jail_register(); stclohz = (stathz ? stathz : hz); |