diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2010-03-11 14:49:06 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2010-03-11 14:49:06 +0000 |
commit | 142a4d29938aa4f7dde8d4ae621c479cc53fda36 (patch) | |
tree | e7bb2301107c48074cb0dbfffd43ee1f7e425d97 /sys/compat/ia32/ia32_sysvec.c | |
parent | d937b522a1d72eb6b270db5bf368d3fd1a79ebcf (diff) | |
download | FreeBSD-src-142a4d29938aa4f7dde8d4ae621c479cc53fda36.zip FreeBSD-src-142a4d29938aa4f7dde8d4ae621c479cc53fda36.tar.gz |
Provide groundwork for 32-bit binary compatibility on non-x86 platforms,
for upcoming 64-bit PowerPC and MIPS support. This renames the COMPAT_IA32
option to COMPAT_FREEBSD32, removes some IA32-specific code from MI parts
of the kernel and enhances the freebsd32 compatibility code to support
big-endian platforms.
Reviewed by: kib, jhb
Diffstat (limited to 'sys/compat/ia32/ia32_sysvec.c')
-rw-r--r-- | sys/compat/ia32/ia32_sysvec.c | 124 |
1 files changed, 1 insertions, 123 deletions
diff --git a/sys/compat/ia32/ia32_sysvec.c b/sys/compat/ia32/ia32_sysvec.c index cb8d33d..79448a5 100644 --- a/sys/compat/ia32/ia32_sysvec.c +++ b/sys/compat/ia32/ia32_sysvec.c @@ -93,7 +93,6 @@ CTASSERT(sizeof(struct ia32_ucontext4) == 324); CTASSERT(sizeof(struct ia32_sigframe4) == 408); #endif -static register_t *ia32_copyout_strings(struct image_params *imgp); static void ia32_fixlimit(struct rlimit *rl, int which); SYSCTL_NODE(_compat, OID_AUTO, ia32, CTLFLAG_RW, 0, "ia32 mode"); @@ -132,7 +131,7 @@ struct sysentvec ia32_freebsd_sysvec = { .sv_usrstack = FREEBSD32_USRSTACK, .sv_psstrings = FREEBSD32_PS_STRINGS, .sv_stackprot = VM_PROT_ALL, - .sv_copyout_strings = ia32_copyout_strings, + .sv_copyout_strings = freebsd32_copyout_strings, .sv_setregs = ia32_setregs, .sv_fixlimit = ia32_fixlimit, .sv_maxssiz = &ia32_maxssiz, @@ -194,127 +193,6 @@ elf32_dump_thread(struct thread *td __unused, void *dst __unused, { } - -/* XXX may be freebsd32 MI */ -static register_t * -ia32_copyout_strings(struct image_params *imgp) -{ - int argc, envc; - u_int32_t *vectp; - char *stringp, *destp; - u_int32_t *stack_base; - struct freebsd32_ps_strings *arginfo; - size_t execpath_len; - int szsigcode; - - /* - * Calculate string base and vector table pointers. - * Also deal with signal trampoline code for this exec type. - */ - if (imgp->execpath != NULL && imgp->auxargs != NULL) - execpath_len = strlen(imgp->execpath) + 1; - else - execpath_len = 0; - arginfo = (struct freebsd32_ps_strings *)FREEBSD32_PS_STRINGS; - szsigcode = *(imgp->proc->p_sysent->sv_szsigcode); - destp = (caddr_t)arginfo - szsigcode - SPARE_USRSPACE - - roundup(execpath_len, sizeof(char *)) - - roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *)); - - /* - * install sigcode - */ - if (szsigcode) - copyout(imgp->proc->p_sysent->sv_sigcode, - ((caddr_t)arginfo - szsigcode), szsigcode); - - /* - * Copy the image path for the rtld. - */ - if (execpath_len != 0) { - imgp->execpathp = (uintptr_t)arginfo - szsigcode - execpath_len; - copyout(imgp->execpath, (void *)imgp->execpathp, - execpath_len); - } - - /* - * If we have a valid auxargs ptr, prepare some room - * on the stack. - */ - if (imgp->auxargs) { - /* - * 'AT_COUNT*2' is size for the ELF Auxargs data. This is for - * lower compatibility. - */ - imgp->auxarg_size = (imgp->auxarg_size) ? imgp->auxarg_size - : (AT_COUNT * 2); - /* - * The '+ 2' is for the null pointers at the end of each of - * the arg and env vector sets,and imgp->auxarg_size is room - * for argument of Runtime loader. - */ - vectp = (u_int32_t *) (destp - (imgp->args->argc + - imgp->args->envc + 2 + imgp->auxarg_size + execpath_len) * - sizeof(u_int32_t)); - } else - /* - * The '+ 2' is for the null pointers at the end of each of - * the arg and env vector sets - */ - vectp = (u_int32_t *) - (destp - (imgp->args->argc + imgp->args->envc + 2) * sizeof(u_int32_t)); - - /* - * vectp also becomes our initial stack base - */ - stack_base = vectp; - - stringp = imgp->args->begin_argv; - argc = imgp->args->argc; - envc = imgp->args->envc; - /* - * Copy out strings - arguments and environment. - */ - copyout(stringp, destp, ARG_MAX - imgp->args->stringspace); - - /* - * Fill in "ps_strings" struct for ps, w, etc. - */ - suword32(&arginfo->ps_argvstr, (u_int32_t)(intptr_t)vectp); - suword32(&arginfo->ps_nargvstr, argc); - - /* - * Fill in argument portion of vector table. - */ - for (; argc > 0; --argc) { - suword32(vectp++, (u_int32_t)(intptr_t)destp); - while (*stringp++ != 0) - destp++; - destp++; - } - - /* a null vector table pointer separates the argp's from the envp's */ - suword32(vectp++, 0); - - suword32(&arginfo->ps_envstr, (u_int32_t)(intptr_t)vectp); - suword32(&arginfo->ps_nenvstr, envc); - - /* - * Fill in environment portion of vector table. - */ - for (; envc > 0; --envc) { - suword32(vectp++, (u_int32_t)(intptr_t)destp); - while (*stringp++ != 0) - destp++; - destp++; - } - - /* end of vector table is a null pointer */ - suword32(vectp, 0); - - return ((register_t *)stack_base); -} - static void ia32_fixlimit(struct rlimit *rl, int which) { |