rem: if(segment->p_filesz % PAGE_SIZE > 0) {
add: if (segment->p_filesz % PAGE_SIZE > 0) { PRINT(("memsetting 0 to va 0x%x, size %d\n", (void*)((unsigned)segment->p_vaddr + segment->p_filesz), PAGE_SIZE  - (segment->p_filesz % PAGE_SIZE)));
context: static void load_elf_image(void *data, unsigned int *next_paddr, addr_range *ar0, addr_range *ar1, unsigned int *start_addr, addr_range *dynamic_section){	struct Elf32_Ehdr *imageHeader = (struct Elf32_Ehdr*) data;	struct Elf32_Phdr *segments = (struct Elf32_Phdr*)(imageHeader->e_phoff + (unsigned) imageHeader);	int segmentIndex;	int foundSegmentIndex = 0;	ar0->size = 0;	ar1->size = 0;	dynamic_section->size = 0;	for (segmentIndex = 0; segmentIndex < imageHeader->e_phnum; segmentIndex++) {		struct Elf32_Phdr *segment = &segments[segmentIndex];		unsigned segmentOffset;		switch(segment->p_type) {			case PT_LOAD:				break;			case PT_DYNAMIC:				dynamic_section->start = segment->p_vaddr;				dynamic_section->size = segment->p_memsz;			default:				continue;		}//		dprintf("segment %d\n", segmentIndex);//		dprintf("p_vaddr 0x%x p_paddr 0x%x p_filesz 0x%x p_memsz 0x%x\n",//			segment->p_vaddr, segment->p_paddr, segment->p_filesz, segment->p_memsz);		/* Map initialized portion */		for (segmentOffset = 0;			segmentOffset < ROUNDUP(segment->p_filesz, PAGE_SIZE);			segmentOffset += PAGE_SIZE) {			mmu_map_page(segment->p_vaddr + segmentOffset, *next_paddr);			memcpy((void *)ROUNDOWN(segment->p_vaddr + segmentOffset, PAGE_SIZE),				(void *)ROUNDOWN((unsigned)data + segment->p_offset + segmentOffset, PAGE_SIZE), PAGE_SIZE);			(*next_paddr) += PAGE_SIZE;		}		/* Clean out the leftover part of the last page */		if(segment->p_filesz % PAGE_SIZE > 0) {//			dprintf("memsetting 0 to va 0x%x, size %d\n", (void*)((unsigned)segment->p_vaddr + segment->p_filesz), PAGE_SIZE  - (segment->p_filesz % PAGE_SIZE));			memset((void*)((unsigned)segment->p_vaddr + segment->p_filesz), 0, PAGE_SIZE				- (segment->p_filesz % PAGE_SIZE));		}		/* Map uninitialized portion */		for (; segmentOffset < ROUNDUP(segment->p_memsz, PAGE_SIZE); segmentOffset += PAGE_SIZE) {//			dprintf("mapping zero page at va 0x%x\n", segment->p_vaddr + segmentOffset);			mmu_map_page(segment->p_vaddr + segmentOffset, *next_paddr);			memset((void *)(segment->p_vaddr + segmentOffset), 0, PAGE_SIZE);			(*next_paddr) += PAGE_SIZE;		}		switch(foundSegmentIndex) {			case 0:				ar0->start = segment->p_vaddr;				ar0->size = segment->p_memsz;				break;			case 1:				ar1->start = segment->p_vaddr;				ar1->size = segment->p_memsz;				break;			default:				;		}		foundSegmentIndex++;	}	*start_addr = imageHeader->e_entry;}