Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/src/mm/page_pt.c

    r346b12a2 r17af882  
    5353static void pt_mapping_insert(as_t *, uintptr_t, uintptr_t, unsigned int);
    5454static void pt_mapping_remove(as_t *, uintptr_t);
    55 static bool pt_mapping_find(as_t *, uintptr_t, bool, pte_t *pte);
    56 static void pt_mapping_update(as_t *, uintptr_t, bool, pte_t *pte);
     55static pte_t *pt_mapping_find(as_t *, uintptr_t, bool);
    5756static void pt_mapping_make_global(uintptr_t, size_t);
    5857
     
    6160        .mapping_remove = pt_mapping_remove,
    6261        .mapping_find = pt_mapping_find,
    63         .mapping_update = pt_mapping_update,
    6462        .mapping_make_global = pt_mapping_make_global
    6563};
     
    291289}
    292290
    293 static pte_t *pt_mapping_find_internal(as_t *as, uintptr_t page, bool nolock)
     291/** Find mapping for virtual page in hierarchical page tables.
     292 *
     293 * @param as     Address space to which page belongs.
     294 * @param page   Virtual page.
     295 * @param nolock True if the page tables need not be locked.
     296 *
     297 * @return NULL if there is no such mapping; entry from PTL3 describing
     298 *         the mapping otherwise.
     299 *
     300 */
     301pte_t *pt_mapping_find(as_t *as, uintptr_t page, bool nolock)
    294302{
    295303        ASSERT(nolock || page_table_locked(as));
     
    326334       
    327335        return &ptl3[PTL3_INDEX(page)];
    328 }
    329 
    330 /** Find mapping for virtual page in hierarchical page tables.
    331  *
    332  * @param as       Address space to which page belongs.
    333  * @param page     Virtual page.
    334  * @param nolock   True if the page tables need not be locked.
    335  * @param[out] pte Structure that will receive a copy of the found PTE.
    336  *
    337  * @return True if the mapping was found, false otherwise.
    338  */
    339 bool pt_mapping_find(as_t *as, uintptr_t page, bool nolock, pte_t *pte)
    340 {
    341         pte_t *t = pt_mapping_find_internal(as, page, nolock);
    342         if (t)
    343                 *pte = *t;
    344         return t != NULL;
    345 }
    346 
    347 /** Update mapping for virtual page in hierarchical page tables.
    348  *
    349  * @param as       Address space to which page belongs.
    350  * @param page     Virtual page.
    351  * @param nolock   True if the page tables need not be locked.
    352  * @param[in] pte  New PTE.
    353  */
    354 void pt_mapping_update(as_t *as, uintptr_t page, bool nolock, pte_t *pte)
    355 {
    356         pte_t *t = pt_mapping_find_internal(as, page, nolock);
    357         if (!t)
    358                 panic("Updating non-existent PTE");     
    359 
    360         ASSERT(PTE_VALID(t) == PTE_VALID(pte));
    361         ASSERT(PTE_PRESENT(t) == PTE_PRESENT(pte));
    362         ASSERT(PTE_GET_FRAME(t) == PTE_GET_FRAME(pte));
    363         ASSERT(PTE_WRITABLE(t) == PTE_WRITABLE(pte));
    364         ASSERT(PTE_EXECUTABLE(t) == PTE_EXECUTABLE(pte));
    365 
    366         *t = *pte;
    367336}
    368337
Note: See TracChangeset for help on using the changeset viewer.