Ignore:
File:
1 edited

Legend:

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

    r59fb782 r9d58539  
    5858static void elf_destroy(as_area_t *);
    5959
    60 static bool elf_is_resizable(as_area_t *);
    61 static bool elf_is_shareable(as_area_t *);
    62 
    6360static int elf_page_fault(as_area_t *, uintptr_t, pf_access_t);
    6461static void elf_frame_free(as_area_t *, uintptr_t, uintptr_t);
     
    6966        .share = elf_share,
    7067        .destroy = elf_destroy,
    71 
    72         .is_resizable = elf_is_resizable,
    73         .is_shareable = elf_is_shareable,
    7468
    7569        .page_fault = elf_page_fault,
     
    219213}
    220214
    221 bool elf_is_resizable(as_area_t *area)
    222 {
    223         return true;
    224 }
    225 
    226 bool elf_is_shareable(as_area_t *area)
    227 {
    228         return true;
    229 }
    230 
    231 
    232215/** Service a page fault in the ELF backend address space area.
    233216 *
     
    235218 *
    236219 * @param area          Pointer to the address space area.
    237  * @param upage         Faulting virtual page.
     220 * @param addr          Faulting virtual address.
    238221 * @param access        Access mode that caused the fault (i.e.
    239222 *                      read/write/exec).
     
    242225 *                      on success (i.e. serviced).
    243226 */
    244 int elf_page_fault(as_area_t *area, uintptr_t upage, pf_access_t access)
     227int elf_page_fault(as_area_t *area, uintptr_t addr, pf_access_t access)
    245228{
    246229        elf_header_t *elf = area->backend_data.elf;
     
    250233        uintptr_t frame;
    251234        uintptr_t kpage;
     235        uintptr_t upage;
    252236        uintptr_t start_anon;
    253237        size_t i;
     
    256240        ASSERT(page_table_locked(AS));
    257241        ASSERT(mutex_locked(&area->lock));
    258         ASSERT(IS_ALIGNED(upage, PAGE_SIZE));
    259242
    260243        if (!as_area_check_access(area, access))
    261244                return AS_PF_FAULT;
    262245       
    263         if (upage < ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE))
     246        if (addr < ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE))
    264247                return AS_PF_FAULT;
    265248       
    266         if (upage >= entry->p_vaddr + entry->p_memsz)
     249        if (addr >= entry->p_vaddr + entry->p_memsz)
    267250                return AS_PF_FAULT;
    268251       
    269         i = (upage - ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE)) >> PAGE_WIDTH;
     252        i = (addr - ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE)) >> PAGE_WIDTH;
    270253        base = (uintptr_t)
    271254            (((void *) elf) + ALIGN_DOWN(entry->p_offset, PAGE_SIZE));
     255
     256        /* Virtual address of faulting page */
     257        upage = ALIGN_DOWN(addr, PAGE_SIZE);
    272258
    273259        /* Virtual address of the end of initialized part of segment */
Note: See TracChangeset for help on using the changeset viewer.