Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/mm/backend_elf.c

    r9d58539 r59fb782  
    5858static void elf_destroy(as_area_t *);
    5959
     60static bool elf_is_resizable(as_area_t *);
     61static bool elf_is_shareable(as_area_t *);
     62
    6063static int elf_page_fault(as_area_t *, uintptr_t, pf_access_t);
    6164static void elf_frame_free(as_area_t *, uintptr_t, uintptr_t);
     
    6669        .share = elf_share,
    6770        .destroy = elf_destroy,
     71
     72        .is_resizable = elf_is_resizable,
     73        .is_shareable = elf_is_shareable,
    6874
    6975        .page_fault = elf_page_fault,
     
    213219}
    214220
     221bool elf_is_resizable(as_area_t *area)
     222{
     223        return true;
     224}
     225
     226bool elf_is_shareable(as_area_t *area)
     227{
     228        return true;
     229}
     230
     231
    215232/** Service a page fault in the ELF backend address space area.
    216233 *
     
    218235 *
    219236 * @param area          Pointer to the address space area.
    220  * @param addr          Faulting virtual address.
     237 * @param upage         Faulting virtual page.
    221238 * @param access        Access mode that caused the fault (i.e.
    222239 *                      read/write/exec).
     
    225242 *                      on success (i.e. serviced).
    226243 */
    227 int elf_page_fault(as_area_t *area, uintptr_t addr, pf_access_t access)
     244int elf_page_fault(as_area_t *area, uintptr_t upage, pf_access_t access)
    228245{
    229246        elf_header_t *elf = area->backend_data.elf;
     
    233250        uintptr_t frame;
    234251        uintptr_t kpage;
    235         uintptr_t upage;
    236252        uintptr_t start_anon;
    237253        size_t i;
     
    240256        ASSERT(page_table_locked(AS));
    241257        ASSERT(mutex_locked(&area->lock));
     258        ASSERT(IS_ALIGNED(upage, PAGE_SIZE));
    242259
    243260        if (!as_area_check_access(area, access))
    244261                return AS_PF_FAULT;
    245262       
    246         if (addr < ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE))
     263        if (upage < ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE))
    247264                return AS_PF_FAULT;
    248265       
    249         if (addr >= entry->p_vaddr + entry->p_memsz)
     266        if (upage >= entry->p_vaddr + entry->p_memsz)
    250267                return AS_PF_FAULT;
    251268       
    252         i = (addr - ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE)) >> PAGE_WIDTH;
     269        i = (upage - ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE)) >> PAGE_WIDTH;
    253270        base = (uintptr_t)
    254271            (((void *) elf) + ALIGN_DOWN(entry->p_offset, PAGE_SIZE));
    255 
    256         /* Virtual address of faulting page */
    257         upage = ALIGN_DOWN(addr, PAGE_SIZE);
    258272
    259273        /* Virtual address of the end of initialized part of segment */
Note: See TracChangeset for help on using the changeset viewer.