Revision 2f619698 linux-user/flatload.c
b/linux-user/flatload.c | ||
---|---|---|
598 | 598 |
rp = datapos; |
599 | 599 |
while (1) { |
600 | 600 |
abi_ulong addr; |
601 |
addr = tgetl(rp); |
|
601 |
if (get_user_ual(addr, rp)) |
|
602 |
return -EFAULT; |
|
602 | 603 |
if (addr == -1) |
603 | 604 |
break; |
604 | 605 |
if (addr) { |
605 | 606 |
addr = calc_reloc(addr, libinfo, id, 0); |
606 | 607 |
if (addr == RELOC_FAILED) |
607 | 608 |
return -ENOEXEC; |
608 |
tputl(rp, addr); |
|
609 |
if (put_user_ual(addr, rp)) |
|
610 |
return -EFAULT; |
|
609 | 611 |
} |
610 | 612 |
rp += sizeof(abi_ulong); |
611 | 613 |
} |
... | ... | |
629 | 631 |
/* Get the address of the pointer to be |
630 | 632 |
relocated (of course, the address has to be |
631 | 633 |
relocated first). */ |
632 |
relval = tgetl(reloc + i * sizeof (abi_ulong)); |
|
634 |
if (get_user_ual(relval, reloc + i * sizeof(abi_ulong))) |
|
635 |
return -EFAULT; |
|
633 | 636 |
addr = flat_get_relocate_addr(relval); |
634 | 637 |
rp = calc_reloc(addr, libinfo, id, 1); |
635 | 638 |
if (rp == RELOC_FAILED) |
636 | 639 |
return -ENOEXEC; |
637 | 640 |
|
638 | 641 |
/* Get the pointer's value. */ |
639 |
addr = tgetl(rp); |
|
642 |
if (get_user_ual(addr, rp)) |
|
643 |
return -EFAULT; |
|
640 | 644 |
if (addr != 0) { |
641 | 645 |
/* |
642 | 646 |
* Do the relocation. PIC relocs in the data section are |
... | ... | |
652 | 656 |
return -ENOEXEC; |
653 | 657 |
|
654 | 658 |
/* Write back the relocated pointer. */ |
655 |
tputl(rp, addr); |
|
659 |
if (put_user_ual(addr, rp)) |
|
660 |
return -EFAULT; |
|
656 | 661 |
} |
657 | 662 |
} |
658 | 663 |
} else { |
659 | 664 |
for (i = 0; i < relocs; i++) { |
660 | 665 |
abi_ulong relval; |
661 |
relval = tgetl(reloc + i * sizeof (abi_ulong)); |
|
666 |
if (get_user_ual(relval, reloc + i * sizeof(abi_ulong))) |
|
667 |
return -EFAULT; |
|
662 | 668 |
old_reloc(&libinfo[0], relval); |
663 | 669 |
} |
664 | 670 |
} |
... | ... | |
744 | 750 |
p = libinfo[i].start_data; |
745 | 751 |
for (j=0; j<MAX_SHARED_LIBS; j++) { |
746 | 752 |
p -= 4; |
747 |
tput32(p, libinfo[j].loaded |
|
748 |
? libinfo[j].start_data |
|
749 |
: UNLOADED_LIB); |
|
753 |
/* FIXME - handle put_user() failures */ |
|
754 |
if (put_user_ual(libinfo[j].loaded |
|
755 |
? libinfo[j].start_data |
|
756 |
: UNLOADED_LIB, |
|
757 |
p)) |
|
758 |
return -EFAULT; |
|
750 | 759 |
} |
751 | 760 |
} |
752 | 761 |
} |
... | ... | |
779 | 788 |
for (i = MAX_SHARED_LIBS-1; i>0; i--) { |
780 | 789 |
if (libinfo[i].loaded) { |
781 | 790 |
/* Push previos first to call address */ |
782 |
--sp; put_user(start_addr, sp); |
|
791 |
--sp; |
|
792 |
if (put_user_ual(start_addr, sp)) |
|
793 |
return -EFAULT; |
|
783 | 794 |
start_addr = libinfo[i].entry; |
784 | 795 |
} |
785 | 796 |
} |
Also available in: Unified diff