Ignore:
File:
1 edited

Legend:

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

    r560b81c r8cbf1c3  
    137137/** Find mapping for virtual page.
    138138 *
    139  * @param as       Address space to which page belongs.
    140  * @param page     Virtual page.
    141  * @param nolock   True if the page tables need not be locked.
    142  * @param[out] pte Structure that will receive a copy of the found PTE.
    143  *
    144  * @return True if a valid PTE is returned, false otherwise. Note that
    145  *         the PTE is not guaranteed to be present.
    146  */
    147 NO_TRACE bool page_mapping_find(as_t *as, uintptr_t page, bool nolock,
    148     pte_t *pte)
     139 * @param as     Address space to which page belongs.
     140 * @param page   Virtual page.
     141 * @param nolock True if the page tables need not be locked.
     142 *
     143 * @return NULL if there is no such mapping; requested mapping
     144 *         otherwise.
     145 *
     146 */
     147NO_TRACE pte_t *page_mapping_find(as_t *as, uintptr_t page, bool nolock)
    149148{
    150149        ASSERT(nolock || page_table_locked(as));
     
    154153       
    155154        return page_mapping_operations->mapping_find(as,
    156             ALIGN_DOWN(page, PAGE_SIZE), nolock, pte);
    157 }
    158 
    159 /** Update mapping for virtual page.
    160  *
    161  * Use only to update accessed and modified/dirty bits.
    162  *
    163  * @param as       Address space to which page belongs.
    164  * @param page     Virtual page.
    165  * @param nolock   True if the page tables need not be locked.
    166  * @param pte      New PTE.
    167  */
    168 NO_TRACE void page_mapping_update(as_t *as, uintptr_t page, bool nolock,
    169     pte_t *pte)
    170 {
    171         ASSERT(nolock || page_table_locked(as));
    172        
    173         ASSERT(page_mapping_operations);
    174         ASSERT(page_mapping_operations->mapping_find);
    175        
    176         page_mapping_operations->mapping_update(as,
    177             ALIGN_DOWN(page, PAGE_SIZE), nolock, pte);
     155            ALIGN_DOWN(page, PAGE_SIZE), nolock);
    178156}
    179157
     
    195173        page_table_lock(AS, true);
    196174       
    197         pte_t pte;
    198         bool found = page_mapping_find(AS, virt, false, &pte);
    199         if (!found || !PTE_VALID(&pte) || !PTE_PRESENT(&pte)) {
     175        pte_t *pte = page_mapping_find(AS, virt, false);
     176        if ((!PTE_VALID(pte)) || (!PTE_PRESENT(pte))) {
    200177                page_table_unlock(AS, true);
    201178                return ENOENT;
    202179        }
    203180       
    204         *phys = PTE_GET_FRAME(&pte) +
     181        *phys = PTE_GET_FRAME(pte) +
    205182            (virt - ALIGN_DOWN(virt, PAGE_SIZE));
    206183       
Note: See TracChangeset for help on using the changeset viewer.