Changeset 8f6c6264 in mainline


Ignore:
Timestamp:
2011-04-17T20:39:43Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
164c653, a7dbd49
Parents:
3ac69647
Message:

More precise elf_nonanon_pages_get() wrt. elf_page_fault().

File:
1 edited

Legend:

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

    r3ac69647 r8f6c6264  
    7373{
    7474        elf_segment_header_t *entry = area->backend_data.segment;
    75         size_t nonanon_pages = ALIGN_DOWN(entry->p_filesz, PAGE_SIZE);
     75        uintptr_t first = ALIGN_UP(entry->p_vaddr, PAGE_SIZE);
     76        uintptr_t last = ALIGN_DOWN(entry->p_vaddr + entry->p_filesz,
     77            PAGE_SIZE);
    7678
    7779        if (entry->p_flags & PF_W)
    7880                return 0;
    7981
    80         return nonanon_pages;
     82        if (last < first)
     83                return 0;
     84
     85        return last - first;
    8186}
    8287
Note: See TracChangeset for help on using the changeset viewer.