Changeset 2a2fbc8 in mainline for kernel/genarch/src/mm/page_pt.c


Ignore:
Timestamp:
2016-09-01T17:05:13Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
42d08592
Parents:
f126c87 (diff), fb63c06 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge from lp:~jakub/helenos/pt

File:
1 edited

Legend:

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

    rf126c87 r2a2fbc8  
    5353static void pt_mapping_insert(as_t *, uintptr_t, uintptr_t, unsigned int);
    5454static void pt_mapping_remove(as_t *, uintptr_t);
    55 static pte_t *pt_mapping_find(as_t *, uintptr_t, bool);
     55static bool pt_mapping_find(as_t *, uintptr_t, bool, pte_t *pte);
     56static void pt_mapping_update(as_t *, uintptr_t, bool, pte_t *pte);
    5657static void pt_mapping_make_global(uintptr_t, size_t);
    5758
     
    6061        .mapping_remove = pt_mapping_remove,
    6162        .mapping_find = pt_mapping_find,
     63        .mapping_update = pt_mapping_update,
    6264        .mapping_make_global = pt_mapping_make_global
    6365};
     
    289291}
    290292
    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  */
    301 pte_t *pt_mapping_find(as_t *as, uintptr_t page, bool nolock)
     293static pte_t *pt_mapping_find_internal(as_t *as, uintptr_t page, bool nolock)
    302294{
    303295        ASSERT(nolock || page_table_locked(as));
     
    334326       
    335327        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 */
     339bool 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 */
     354void 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;
    336367}
    337368
Note: See TracChangeset for help on using the changeset viewer.