Ignore:
File:
1 edited

Legend:

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

    r346b12a2 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 the mapping was found, false otherwise.
    145  */
    146 NO_TRACE bool page_mapping_find(as_t *as, uintptr_t page, bool nolock,
    147     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)
    148148{
    149149        ASSERT(nolock || page_table_locked(as));
     
    153153       
    154154        return page_mapping_operations->mapping_find(as,
    155             ALIGN_DOWN(page, PAGE_SIZE), nolock, pte);
    156 }
    157 
    158 /** Update mapping for virtual page.
    159  *
    160  * Use only to update accessed and modified/dirty bits.
    161  *
    162  * @param as       Address space to which page belongs.
    163  * @param page     Virtual page.
    164  * @param nolock   True if the page tables need not be locked.
    165  * @param pte      New PTE.
    166  */
    167 NO_TRACE void page_mapping_update(as_t *as, uintptr_t page, bool nolock,
    168     pte_t *pte)
    169 {
    170         ASSERT(nolock || page_table_locked(as));
    171        
    172         ASSERT(page_mapping_operations);
    173         ASSERT(page_mapping_operations->mapping_find);
    174        
    175         page_mapping_operations->mapping_update(as,
    176             ALIGN_DOWN(page, PAGE_SIZE), nolock, pte);
     155            ALIGN_DOWN(page, PAGE_SIZE), nolock);
    177156}
    178157
     
    194173        page_table_lock(AS, true);
    195174       
    196         pte_t pte;
    197         bool found = page_mapping_find(AS, virt, false, &pte);
    198         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))) {
    199177                page_table_unlock(AS, true);
    200178                return ENOENT;
    201179        }
    202180       
    203         *phys = PTE_GET_FRAME(&pte) +
     181        *phys = PTE_GET_FRAME(pte) +
    204182            (virt - ALIGN_DOWN(virt, PAGE_SIZE));
    205183       
Note: See TracChangeset for help on using the changeset viewer.