Revision b17780d5
b/linux-user/elfload.c | ||
---|---|---|
335 | 335 |
unsigned long interp_load_addr, int ibcs, |
336 | 336 |
struct image_info *info) |
337 | 337 |
{ |
338 |
unsigned int *argv, *envp, *dlinfo; |
|
339 |
unsigned int *sp; |
|
340 |
char **alpha_envp; |
|
338 |
target_ulong *argv, *envp, *dlinfo; |
|
339 |
target_ulong *sp; |
|
341 | 340 |
|
342 | 341 |
/* |
343 | 342 |
* Force 16 byte alignment here for generality. |
... | ... | |
350 | 349 |
sp -= argc+1; |
351 | 350 |
argv = sp; |
352 | 351 |
if (!ibcs) { |
353 |
put_user(envp,--sp);
|
|
354 |
put_user(argv,--sp);
|
|
352 |
put_user(tswapl((target_ulong)envp),--sp);
|
|
353 |
put_user(tswapl((target_ulong)argv),--sp);
|
|
355 | 354 |
} |
356 |
alpha_envp = (char **)malloc((envc+1) * sizeof(char *)); |
|
357 | 355 |
|
358 | 356 |
#define NEW_AUX_ENT(id, val) \ |
359 |
put_user ((id), dlinfo++); \ |
|
360 |
put_user ((val), dlinfo++) |
|
357 |
put_user (tswapl(id), dlinfo++); \
|
|
358 |
put_user (tswapl(val), dlinfo++)
|
|
361 | 359 |
|
362 | 360 |
if (exec) { /* Put this here for an ELF program interpreter */ |
363 | 361 |
struct elf_phdr * eppnt; |
... | ... | |
377 | 375 |
} |
378 | 376 |
NEW_AUX_ENT (AT_NULL, 0); |
379 | 377 |
#undef NEW_AUX_ENT |
380 |
put_user((unsigned int)argc,--sp);
|
|
378 |
put_user(tswapl(argc),--sp);
|
|
381 | 379 |
info->arg_start = (unsigned int)((unsigned long)p & 0xffffffff); |
382 | 380 |
while (argc-->0) { |
383 |
put_user(p,argv++);
|
|
381 |
put_user(tswapl((target_ulong)p),argv++);
|
|
384 | 382 |
while (get_user(p++)) /* nothing */ ; |
385 | 383 |
} |
386 | 384 |
put_user(0,argv); |
387 | 385 |
info->arg_end = info->env_start = (unsigned int)((unsigned long)p & 0xffffffff); |
388 |
__environ = alpha_envp; |
|
389 | 386 |
while (envc-->0) { |
390 |
*alpha_envp++ = (char *)p; |
|
391 |
put_user(p,envp++); |
|
387 |
put_user(tswapl((target_ulong)p),envp++); |
|
392 | 388 |
while (get_user(p++)) /* nothing */ ; |
393 | 389 |
} |
394 | 390 |
put_user(0,envp); |
395 |
*alpha_envp = 0; |
|
396 | 391 |
info->env_end = (unsigned int)((unsigned long)p & 0xffffffff); |
397 | 392 |
return sp; |
398 | 393 |
} |
... | ... | |
544 | 539 |
|
545 | 540 |
|
546 | 541 |
|
547 |
static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs, |
|
548 |
struct image_info * info)
|
|
542 |
static int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
|
|
543 |
struct image_info * info)
|
|
549 | 544 |
{ |
550 | 545 |
struct elfhdr elf_ex; |
551 | 546 |
struct elfhdr interp_elf_ex; |
... | ... | |
581 | 576 |
return -ENOEXEC; |
582 | 577 |
} |
583 | 578 |
|
584 |
|
|
585 | 579 |
/* First of all, some simple consistency checks */ |
586 | 580 |
if ((elf_ex.e_type != ET_EXEC && elf_ex.e_type != ET_DYN) || |
587 | 581 |
(! elf_check_arch(elf_ex.e_machine))) { |
... | ... | |
608 | 602 |
return -errno; |
609 | 603 |
} |
610 | 604 |
|
605 |
#ifdef BSWAP_NEEDED |
|
606 |
elf_ppnt = elf_phdata; |
|
607 |
for (i=0; i<elf_ex.e_phnum; i++, elf_ppnt++) { |
|
608 |
bswap_phdr(elf_ppnt); |
|
609 |
} |
|
610 |
#endif |
|
611 | 611 |
elf_ppnt = elf_phdata; |
612 | 612 |
|
613 | 613 |
elf_bss = 0; |
... | ... | |
909 | 909 |
|
910 | 910 |
|
911 | 911 |
int elf_exec(const char * filename, char ** argv, char ** envp, |
912 |
struct pt_regs * regs, struct image_info *infop)
|
|
912 |
struct target_pt_regs * regs, struct image_info *infop)
|
|
913 | 913 |
{ |
914 | 914 |
struct linux_binprm bprm; |
915 | 915 |
int retval; |
Also available in: Unified diff