Revision 768a4a36
b/linux-user/elfload.c | ||
---|---|---|
553 | 553 |
/* We need to explicitly zero any fractional pages after the data |
554 | 554 |
section (i.e. bss). This would contain the junk from the file that |
555 | 555 |
should not be in memory. */ |
556 |
static void padzero(unsigned long elf_bss) |
|
556 |
static void padzero(unsigned long elf_bss, unsigned long last_bss)
|
|
557 | 557 |
{ |
558 | 558 |
unsigned long nbyte; |
559 | 559 |
|
560 |
if (elf_bss >= last_bss) |
|
561 |
return; |
|
562 |
|
|
560 | 563 |
/* XXX: this is really a hack : if the real host page size is |
561 | 564 |
smaller than the target page size, some pages after the end |
562 | 565 |
of the file may not be mapped. A better fix would be to |
... | ... | |
798 | 801 |
* that there are zeromapped pages up to and including the last |
799 | 802 |
* bss page. |
800 | 803 |
*/ |
801 |
padzero(elf_bss); |
|
804 |
padzero(elf_bss, last_bss);
|
|
802 | 805 |
elf_bss = TARGET_ELF_PAGESTART(elf_bss + qemu_host_page_size - 1); /* What we have mapped so far */ |
803 | 806 |
|
804 | 807 |
/* Map the last of the bss segment */ |
... | ... | |
1227 | 1230 |
sections */ |
1228 | 1231 |
set_brk(elf_bss, elf_brk); |
1229 | 1232 |
|
1230 |
padzero(elf_bss); |
|
1233 |
padzero(elf_bss, elf_brk);
|
|
1231 | 1234 |
|
1232 | 1235 |
#if 0 |
1233 | 1236 |
printf("(start_brk) %x\n" , info->start_brk); |
Also available in: Unified diff