Changeset 8f00329 in mainline for genarch/src/mm/page_pt.c


Ignore:
Timestamp:
2006-02-09T21:59:31Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a3eeceb6
Parents:
bfb87df
Message:

Add page_mapping_remove().

File:
1 edited

Legend:

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

    rbfb87df r8f00329  
    3939
    4040static void pt_mapping_insert(as_t *as, __address page, __address frame, int flags);
     41static void pt_mapping_remove(as_t *as, __address page);
    4142static pte_t *pt_mapping_find(as_t *as, __address page);
    4243
    4344page_mapping_operations_t pt_mapping_operations = {
    4445        .mapping_insert = pt_mapping_insert,
     46        .mapping_remove = pt_mapping_remove,
    4547        .mapping_find = pt_mapping_find
    4648};
     
    9698}
    9799
     100/** Remove mapping of page from hierarchical page tables.
     101 *
     102 * Remove any mapping of 'page' within address space 'as'.
     103 * TLB shootdown should follow in order to make effects of
     104 * this call visible.
     105 *
     106 * The address space must be locked and interrupts must be disabled.
     107 *
     108 * @param as Address space to wich page belongs.
     109 * @param page Virtual address of the page to be demapped.
     110 */
     111void pt_mapping_remove(as_t *as, __address page)
     112{
     113        pte_t *ptl0, *ptl1, *ptl2, *ptl3;
     114
     115        ptl0 = (pte_t *) PA2KA((__address) as->page_table);
     116
     117        if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT)
     118                return;
     119
     120        ptl1 = (pte_t *) PA2KA(GET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page)));
     121
     122        if (GET_PTL2_FLAGS(ptl1, PTL1_INDEX(page)) & PAGE_NOT_PRESENT)
     123                return;
     124
     125        ptl2 = (pte_t *) PA2KA(GET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page)));
     126
     127        if (GET_PTL3_FLAGS(ptl2, PTL2_INDEX(page)) & PAGE_NOT_PRESENT)
     128                return;
     129
     130        ptl3 = (pte_t *) PA2KA(GET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page)));
     131
     132        /* Destroy the mapping. Setting to PAGE_NOT_PRESENT is not sufficient. */
     133        memsetb((__address) &ptl3[PTL3_INDEX(page)], sizeof(pte_t), 0);
     134}
     135
    98136/** Find mapping for virtual page in hierarchical page tables.
    99137 *
Note: See TracChangeset for help on using the changeset viewer.