/branches/dynload/kernel/generic/src/mm/as.c |
---|
794,7 → 794,12 |
uintptr_t base; |
link_t *cur; |
ipl_t ipl; |
int page_flags; |
int old_frame; |
/* Flags for the new memory mapping */ |
page_flags = area_flags_to_page_flags(flags); |
ipl = interrupts_disable(); |
mutex_lock(&as->lock); |
808,6 → 813,7 |
if (area->sh_info || area->backend != &anon_backend) { |
/* Copying shared areas not supported yet */ |
/* Copying non-anonymous memory not supported yet */ |
mutex_unlock(&area->lock); |
mutex_unlock(&as->lock); |
interrupts_restore(ipl); |
return ENOTSUP; |
839,11 → 845,13 |
pte = page_mapping_find(as, b + j * PAGE_SIZE); |
ASSERT(pte && PTE_VALID(pte) && |
PTE_PRESENT(pte)); |
old_frame = PTE_GET_FRAME_ARCH(pte); |
/* Remove old mapping and insert the new one */ |
page_mapping_remove(as, b + j * PAGE_SIZE); |
page_mapping_insert(as, b + j * PAGE_SIZE, |
PTE_GET_FRAME(pte), flags); |
old_frame, page_flags); |
page_table_unlock(as, false); |
} |
} |
/branches/dynload/uspace/app/iloader/elf_load.c |
---|
293,7 → 293,7 |
} |
} |
/* if (entry->p_flags & PF_X) |
if (entry->p_flags & PF_X) |
flags |= AS_AREA_EXEC; |
if (entry->p_flags & PF_W) |
flags |= AS_AREA_WRITE; |
300,9 → 300,8 |
if (entry->p_flags & PF_R) |
flags |= AS_AREA_READ; |
flags |= AS_AREA_CACHEABLE; |
*/ |
/* FIXME: Kernel won't normally allow this, unless you "patch" it */ |
// flags = AS_AREA_READ | AS_AREA_WRITE | AS_AREA_EXEC | AS_AREA_CACHEABLE; |
/* Final flags for the memory area */ |
flags = AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE; |
/* |
318,8 → 317,12 |
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)); |
/* |
* 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, flags); |
entry->p_memsz, AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE); |
if (a == (void *)(-1)) { |
printf("memory mapping failed\n"); |
return EE_MEMORY; |
355,6 → 358,13 |
dp += now; |
} |
printf("set area flags to %d\n", flags); |
rc = as_area_change_flags((uint8_t *)entry->p_vaddr + bias, flags); |
if (rc != 0) { |
printf("failed to set memory area flags\n"); |
return EE_MEMORY; |
} |
return EE_OK; |
} |
/branches/dynload/uspace/lib/libc/generic/as.c |
---|
95,7 → 95,7 |
*/ |
int as_area_change_flags(void *address, int flags) |
{ |
return __SYSCALL2(SYS_AS_AREA_DESTROY, (sysarg_t) address, |
return __SYSCALL2(SYS_AS_AREA_CHANGE_FLAGS, (sysarg_t) address, |
(sysarg_t) flags); |
} |