Commit a1516e92b6ed887ef27f3a33a27a9acd772a5de4
1 parent
6fb883e8
ARM init fix
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@316 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
16 additions
and
16 deletions
linux-user/elfload.c
@@ -74,7 +74,8 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i | @@ -74,7 +74,8 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i | ||
74 | regs->ARM_sp = infop->start_stack; | 74 | regs->ARM_sp = infop->start_stack; |
75 | regs->ARM_r2 = tswapl(stack[2]); /* envp */ | 75 | regs->ARM_r2 = tswapl(stack[2]); /* envp */ |
76 | regs->ARM_r1 = tswapl(stack[1]); /* argv */ | 76 | regs->ARM_r1 = tswapl(stack[1]); /* argv */ |
77 | - regs->ARM_r0 = tswapl(stack[0]); /* argc */ | 77 | + /* XXX: it seems that r0 is zeroed after ! */ |
78 | + // regs->ARM_r0 = tswapl(stack[0]); /* argc */ | ||
78 | } | 79 | } |
79 | 80 | ||
80 | #define USE_ELF_CORE_DUMP | 81 | #define USE_ELF_CORE_DUMP |
@@ -490,7 +491,7 @@ static unsigned int * create_elf_tables(char *p, int argc, int envc, | @@ -490,7 +491,7 @@ static unsigned int * create_elf_tables(char *p, int argc, int envc, | ||
490 | * Force 16 byte alignment here for generality. | 491 | * Force 16 byte alignment here for generality. |
491 | */ | 492 | */ |
492 | sp = (unsigned int *) (~15UL & (unsigned long) p); | 493 | sp = (unsigned int *) (~15UL & (unsigned long) p); |
493 | - sp -= exec ? DLINFO_ITEMS*2 : 2; | 494 | + sp -= DLINFO_ITEMS*2; |
494 | dlinfo = sp; | 495 | dlinfo = sp; |
495 | sp -= envc+1; | 496 | sp -= envc+1; |
496 | envp = sp; | 497 | envp = sp; |
@@ -505,21 +506,20 @@ static unsigned int * create_elf_tables(char *p, int argc, int envc, | @@ -505,21 +506,20 @@ static unsigned int * create_elf_tables(char *p, int argc, int envc, | ||
505 | put_user (tswapl(id), dlinfo++); \ | 506 | put_user (tswapl(id), dlinfo++); \ |
506 | put_user (tswapl(val), dlinfo++) | 507 | put_user (tswapl(val), dlinfo++) |
507 | 508 | ||
508 | - if (exec) { /* Put this here for an ELF program interpreter */ | ||
509 | - NEW_AUX_ENT (AT_PHDR, (target_ulong)(load_addr + exec->e_phoff)); | ||
510 | - NEW_AUX_ENT (AT_PHENT, (target_ulong)(sizeof (struct elf_phdr))); | ||
511 | - NEW_AUX_ENT (AT_PHNUM, (target_ulong)(exec->e_phnum)); | ||
512 | - NEW_AUX_ENT (AT_PAGESZ, (target_ulong)(TARGET_PAGE_SIZE)); | ||
513 | - NEW_AUX_ENT (AT_BASE, (target_ulong)(interp_load_addr)); | ||
514 | - NEW_AUX_ENT (AT_FLAGS, (target_ulong)0); | ||
515 | - NEW_AUX_ENT (AT_ENTRY, load_bias + exec->e_entry); | ||
516 | - NEW_AUX_ENT (AT_UID, (target_ulong) getuid()); | ||
517 | - NEW_AUX_ENT (AT_EUID, (target_ulong) geteuid()); | ||
518 | - NEW_AUX_ENT (AT_GID, (target_ulong) getgid()); | ||
519 | - NEW_AUX_ENT (AT_EGID, (target_ulong) getegid()); | ||
520 | - } | 509 | + NEW_AUX_ENT (AT_PHDR, (target_ulong)(load_addr + exec->e_phoff)); |
510 | + NEW_AUX_ENT (AT_PHENT, (target_ulong)(sizeof (struct elf_phdr))); | ||
511 | + NEW_AUX_ENT (AT_PHNUM, (target_ulong)(exec->e_phnum)); | ||
512 | + NEW_AUX_ENT (AT_PAGESZ, (target_ulong)(TARGET_PAGE_SIZE)); | ||
513 | + NEW_AUX_ENT (AT_BASE, (target_ulong)(interp_load_addr)); | ||
514 | + NEW_AUX_ENT (AT_FLAGS, (target_ulong)0); | ||
515 | + NEW_AUX_ENT (AT_ENTRY, load_bias + exec->e_entry); | ||
516 | + NEW_AUX_ENT (AT_UID, (target_ulong) getuid()); | ||
517 | + NEW_AUX_ENT (AT_EUID, (target_ulong) geteuid()); | ||
518 | + NEW_AUX_ENT (AT_GID, (target_ulong) getgid()); | ||
519 | + NEW_AUX_ENT (AT_EGID, (target_ulong) getegid()); | ||
521 | NEW_AUX_ENT (AT_NULL, 0); | 520 | NEW_AUX_ENT (AT_NULL, 0); |
522 | #undef NEW_AUX_ENT | 521 | #undef NEW_AUX_ENT |
522 | + | ||
523 | put_user(tswapl(argc),--sp); | 523 | put_user(tswapl(argc),--sp); |
524 | info->arg_start = (unsigned int)((unsigned long)p & 0xffffffff); | 524 | info->arg_start = (unsigned int)((unsigned long)p & 0xffffffff); |
525 | while (argc-->0) { | 525 | while (argc-->0) { |
@@ -1087,7 +1087,7 @@ static int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * r | @@ -1087,7 +1087,7 @@ static int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * r | ||
1087 | create_elf_tables((char *)bprm->p, | 1087 | create_elf_tables((char *)bprm->p, |
1088 | bprm->argc, | 1088 | bprm->argc, |
1089 | bprm->envc, | 1089 | bprm->envc, |
1090 | - (interpreter_type == INTERPRETER_ELF ? &elf_ex : NULL), | 1090 | + &elf_ex, |
1091 | load_addr, load_bias, | 1091 | load_addr, load_bias, |
1092 | interp_load_addr, | 1092 | interp_load_addr, |
1093 | (interpreter_type == INTERPRETER_AOUT ? 0 : 1), | 1093 | (interpreter_type == INTERPRETER_AOUT ? 0 : 1), |