ia32_sysvec.c (189771) | ia32_sysvec.c (189927) |
---|---|
1/*- 2 * Copyright (c) 2002 Doug Rabson 3 * Copyright (c) 2003 Peter Wemm 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2002 Doug Rabson 3 * Copyright (c) 2003 Peter Wemm 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/compat/ia32/ia32_sysvec.c 189771 2009-03-13 16:40:51Z dchagin $"); | 29__FBSDID("$FreeBSD: head/sys/compat/ia32/ia32_sysvec.c 189927 2009-03-17 12:53:28Z kib $"); |
30 31#include "opt_compat.h" 32 33#define __ELF_WORD_SIZE 32 34 35#include <sys/param.h> 36#include <sys/exec.h> 37#include <sys/fcntl.h> --- 146 unchanged lines hidden (view full) --- 184static register_t * 185ia32_copyout_strings(struct image_params *imgp) 186{ 187 int argc, envc; 188 u_int32_t *vectp; 189 char *stringp, *destp; 190 u_int32_t *stack_base; 191 struct freebsd32_ps_strings *arginfo; | 30 31#include "opt_compat.h" 32 33#define __ELF_WORD_SIZE 32 34 35#include <sys/param.h> 36#include <sys/exec.h> 37#include <sys/fcntl.h> --- 146 unchanged lines hidden (view full) --- 184static register_t * 185ia32_copyout_strings(struct image_params *imgp) 186{ 187 int argc, envc; 188 u_int32_t *vectp; 189 char *stringp, *destp; 190 u_int32_t *stack_base; 191 struct freebsd32_ps_strings *arginfo; |
192 size_t execpath_len; |
|
192 int szsigcode; 193 194 /* 195 * Calculate string base and vector table pointers. 196 * Also deal with signal trampoline code for this exec type. 197 */ | 193 int szsigcode; 194 195 /* 196 * Calculate string base and vector table pointers. 197 * Also deal with signal trampoline code for this exec type. 198 */ |
199 if (imgp->execpath != NULL && imgp->auxargs != NULL) 200 execpath_len = strlen(imgp->execpath) + 1; 201 else 202 execpath_len = 0; |
|
198 arginfo = (struct freebsd32_ps_strings *)FREEBSD32_PS_STRINGS; 199 szsigcode = *(imgp->proc->p_sysent->sv_szsigcode); 200 destp = (caddr_t)arginfo - szsigcode - SPARE_USRSPACE - | 203 arginfo = (struct freebsd32_ps_strings *)FREEBSD32_PS_STRINGS; 204 szsigcode = *(imgp->proc->p_sysent->sv_szsigcode); 205 destp = (caddr_t)arginfo - szsigcode - SPARE_USRSPACE - |
206 roundup(execpath_len, sizeof(char *)) - |
|
201 roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *)); 202 203 /* 204 * install sigcode 205 */ 206 if (szsigcode) 207 copyout(imgp->proc->p_sysent->sv_sigcode, 208 ((caddr_t)arginfo - szsigcode), szsigcode); 209 210 /* | 207 roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *)); 208 209 /* 210 * install sigcode 211 */ 212 if (szsigcode) 213 copyout(imgp->proc->p_sysent->sv_sigcode, 214 ((caddr_t)arginfo - szsigcode), szsigcode); 215 216 /* |
217 * Copy the image path for the rtld. 218 */ 219 if (execpath_len != 0) { 220 imgp->execpathp = (uintptr_t)arginfo - szsigcode - execpath_len; 221 copyout(imgp->execpath, (void *)imgp->execpathp, 222 execpath_len); 223 } 224 225 /* |
|
211 * If we have a valid auxargs ptr, prepare some room 212 * on the stack. 213 */ 214 if (imgp->auxargs) { 215 /* 216 * 'AT_COUNT*2' is size for the ELF Auxargs data. This is for 217 * lower compatibility. 218 */ 219 imgp->auxarg_size = (imgp->auxarg_size) ? imgp->auxarg_size 220 : (AT_COUNT * 2); 221 /* 222 * The '+ 2' is for the null pointers at the end of each of 223 * the arg and env vector sets,and imgp->auxarg_size is room 224 * for argument of Runtime loader. 225 */ | 226 * If we have a valid auxargs ptr, prepare some room 227 * on the stack. 228 */ 229 if (imgp->auxargs) { 230 /* 231 * 'AT_COUNT*2' is size for the ELF Auxargs data. This is for 232 * lower compatibility. 233 */ 234 imgp->auxarg_size = (imgp->auxarg_size) ? imgp->auxarg_size 235 : (AT_COUNT * 2); 236 /* 237 * The '+ 2' is for the null pointers at the end of each of 238 * the arg and env vector sets,and imgp->auxarg_size is room 239 * for argument of Runtime loader. 240 */ |
226 vectp = (u_int32_t *) (destp - (imgp->args->argc + imgp->args->envc + 2 + 227 imgp->auxarg_size) * sizeof(u_int32_t)); 228 | 241 vectp = (u_int32_t *) (destp - (imgp->args->argc + 242 imgp->args->envc + 2 + imgp->auxarg_size + execpath_len) * 243 sizeof(u_int32_t)); |
229 } else 230 /* 231 * The '+ 2' is for the null pointers at the end of each of 232 * the arg and env vector sets 233 */ 234 vectp = (u_int32_t *) 235 (destp - (imgp->args->argc + imgp->args->envc + 2) * sizeof(u_int32_t)); 236 --- 82 unchanged lines hidden --- | 244 } else 245 /* 246 * The '+ 2' is for the null pointers at the end of each of 247 * the arg and env vector sets 248 */ 249 vectp = (u_int32_t *) 250 (destp - (imgp->args->argc + imgp->args->envc + 2) * sizeof(u_int32_t)); 251 --- 82 unchanged lines hidden --- |