Revision 5fafdf24 linux-user/flatload.c
b/linux-user/flatload.c | ||
---|---|---|
359 | 359 |
"(address %p, currently %x) into segment %s\n", |
360 | 360 |
offset, ptr, (int)*ptr, segment[reloc_type]); |
361 | 361 |
#endif |
362 |
|
|
362 |
|
|
363 | 363 |
switch (reloc_type) { |
364 | 364 |
case OLD_FLAT_RELOC_TYPE_TEXT: |
365 | 365 |
*ptr += libinfo->start_code; |
... | ... | |
376 | 376 |
break; |
377 | 377 |
} |
378 | 378 |
DBG_FLT("Relocation became %x\n", (int)*ptr); |
379 |
}
|
|
379 |
} |
|
380 | 380 |
|
381 | 381 |
/****************************************************************************/ |
382 | 382 |
|
... | ... | |
416 | 416 |
rev, (int) FLAT_VERSION); |
417 | 417 |
return -ENOEXEC; |
418 | 418 |
} |
419 |
|
|
419 |
|
|
420 | 420 |
/* Don't allow old format executables to use shared libraries */ |
421 | 421 |
if (rev == OLD_FLAT_VERSION && id != 0) { |
422 | 422 |
fprintf(stderr, "BINFMT_FLAT: shared libraries are not available\n"); |
... | ... | |
463 | 463 |
|
464 | 464 |
textpos = target_mmap(0, text_len, PROT_READ|PROT_EXEC, |
465 | 465 |
MAP_PRIVATE, bprm->fd, 0); |
466 |
if (textpos == -1) {
|
|
466 |
if (textpos == -1) { |
|
467 | 467 |
fprintf(stderr, "Unable to mmap process text\n"); |
468 | 468 |
return -1; |
469 | 469 |
} |
... | ... | |
484 | 484 |
fpos = ntohl(hdr->data_start); |
485 | 485 |
#ifdef CONFIG_BINFMT_ZFLAT |
486 | 486 |
if (flags & FLAT_FLAG_GZDATA) { |
487 |
result = decompress_exec(bprm, fpos, (char *) datapos,
|
|
487 |
result = decompress_exec(bprm, fpos, (char *) datapos, |
|
488 | 488 |
data_len + (relocs * sizeof(target_ulong))) |
489 | 489 |
} else |
490 | 490 |
#endif |
... | ... | |
581 | 581 |
libinfo[id].loaded = 1; |
582 | 582 |
libinfo[id].entry = (0x00ffffff & ntohl(hdr->entry)) + textpos; |
583 | 583 |
libinfo[id].build_date = ntohl(hdr->build_date); |
584 |
|
|
584 |
|
|
585 | 585 |
/* |
586 | 586 |
* We just load the allocations into some temporary memory to |
587 | 587 |
* help simplify all this mumbo jumbo |
... | ... | |
662 | 662 |
old_reloc(&libinfo[0], relval); |
663 | 663 |
} |
664 | 664 |
} |
665 |
|
|
665 |
|
|
666 | 666 |
/* zero the BSS. */ |
667 | 667 |
memset((void*)(datapos + data_len), 0, bss_len); |
668 | 668 |
|
... | ... | |
732 | 732 |
stack_len += (bprm->argc + 1) * 4; /* the argv array */ |
733 | 733 |
stack_len += (bprm->envc + 1) * 4; /* the envp array */ |
734 | 734 |
|
735 |
|
|
735 |
|
|
736 | 736 |
res = load_flat_file(bprm, libinfo, 0, &stack_len); |
737 | 737 |
if (res > (unsigned long)-4096) |
738 | 738 |
return res; |
739 |
|
|
739 |
|
|
740 | 740 |
/* Update data segment pointers for all libraries */ |
741 | 741 |
for (i=0; i<MAX_SHARED_LIBS; i++) { |
742 | 742 |
if (libinfo[i].loaded) { |
... | ... | |
767 | 767 |
if ((sp + stack_len) & 15) |
768 | 768 |
sp -= 16 - ((sp + stack_len) & 15); |
769 | 769 |
sp = loader_build_argptr(bprm->envc, bprm->argc, sp, p, 1); |
770 |
|
|
770 |
|
|
771 | 771 |
/* Fake some return addresses to ensure the call chain will |
772 | 772 |
* initialise library in order for us. We are required to call |
773 | 773 |
* lib 1 first, then 2, ... and finally the main program (id 0). |
... | ... | |
784 | 784 |
} |
785 | 785 |
} |
786 | 786 |
#endif |
787 |
|
|
787 |
|
|
788 | 788 |
/* Stash our initial stack pointer into the mm structure */ |
789 | 789 |
info->start_code = libinfo[0].start_code; |
790 | 790 |
info->end_code = libinfo[0].start_code = libinfo[0].text_len; |
... | ... | |
798 | 798 |
|
799 | 799 |
DBG_FLT("start_thread(entry=0x%x, start_stack=0x%x)\n", |
800 | 800 |
(int)info->entry, (int)info->start_stack); |
801 |
|
|
801 |
|
|
802 | 802 |
return 0; |
803 | 803 |
} |
Also available in: Unified diff