Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3009 → Rev 3010

/branches/dynload/uspace/app/iloader/elf_load.c
286,6 → 286,8
void *a;
int flags = 0;
uintptr_t bias;
uintptr_t base;
size_t mem_sz;
int rc;
 
printf("load segment at addr 0x%x, size 0x%x\n", entry->p_vaddr,
313,17 → 315,10
if (entry->p_flags & PF_R)
flags |= AS_AREA_READ;
flags |= AS_AREA_CACHEABLE;
base = ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE);
mem_sz = entry->p_memsz + (entry->p_vaddr - base);
 
/*
* Check if the virtual address starts on page boundary.
*/
if (ALIGN_UP(entry->p_vaddr, PAGE_SIZE) != entry->p_vaddr) {
printf("align check 2 failed - not page-aligned\n");
printf("vaddr = 0x%x, should be 0x%x\n",
entry->p_vaddr, ALIGN_UP(entry->p_vaddr, PAGE_SIZE));
return EE_UNSUPPORTED;
}
printf("map to p_vaddr=0x%x-0x%x...\n", entry->p_vaddr + bias,
entry->p_vaddr + bias + ALIGN_UP(entry->p_memsz, PAGE_SIZE));
 
331,8 → 326,8
* For the course of loading, the area needs to be readable
* and writeable.
*/
a = as_area_create((uint8_t *)entry->p_vaddr + bias,
entry->p_memsz, AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE);
a = as_area_create((uint8_t *)base + bias,
mem_sz, AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE);
if (a == (void *)(-1)) {
printf("memory mapping failed\n");
return EE_MEMORY;