Changeset 8f00329 in mainline
- Timestamp:
- 2006-02-09T21:59:31Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a3eeceb6
- Parents:
- bfb87df
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
genarch/src/mm/page_ht.c
rbfb87df r8f00329 48 48 49 49 static void ht_mapping_insert(as_t *as, __address page, __address frame, int flags); 50 static void ht_mapping_remove(as_t *as, __address page); 50 51 static pte_t *ht_mapping_find(as_t *as, __address page); 51 52 … … 71 72 page_mapping_operations_t ht_mapping_operations = { 72 73 .mapping_insert = ht_mapping_insert, 74 .mapping_remove = ht_mapping_remove, 73 75 .mapping_find = ht_mapping_find 74 76 }; … … 163 165 { 164 166 pte_t *t; 165 ipl_t ipl;166 167 __native key[2] = { (__address) as, page }; 167 168 168 ipl = interrupts_disable();169 169 spinlock_lock(&page_ht_lock); 170 170 … … 177 177 178 178 spinlock_unlock(&page_ht_lock); 179 interrupts_restore(ipl); 180 } 179 } 180 181 /** Remove mapping of page from page hash table. 182 * 183 * Remove any mapping of 'page' within address space 'as'. 184 * TLB shootdown should follow in order to make effects of 185 * this call visible. 186 * 187 * The address space must be locked and interrupts must be disabled. 188 * 189 * @param as Address space to wich page belongs. 190 * @param page Virtual address of the page to be demapped. 191 */ 192 void ht_mapping_remove(as_t *as, __address page) 193 { 194 __native key[2] = { (__address) as, page }; 195 196 spinlock_lock(&page_ht_lock); 197 198 /* 199 * Note that removed PTE's will be freed 200 * by remove_callback(). 201 */ 202 hash_table_remove(&page_ht, key, 2); 203 204 spinlock_unlock(&page_ht_lock); 205 } 206 181 207 182 208 /** Find mapping for virtual page in page hash table. -
genarch/src/mm/page_pt.c
rbfb87df r8f00329 39 39 40 40 static void pt_mapping_insert(as_t *as, __address page, __address frame, int flags); 41 static void pt_mapping_remove(as_t *as, __address page); 41 42 static pte_t *pt_mapping_find(as_t *as, __address page); 42 43 43 44 page_mapping_operations_t pt_mapping_operations = { 44 45 .mapping_insert = pt_mapping_insert, 46 .mapping_remove = pt_mapping_remove, 45 47 .mapping_find = pt_mapping_find 46 48 }; … … 96 98 } 97 99 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 */ 111 void 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 98 136 /** Find mapping for virtual page in hierarchical page tables. 99 137 * -
generic/include/mm/page.h
rbfb87df r8f00329 63 63 struct page_mapping_operations { 64 64 void (* mapping_insert)(as_t *as, __address page, __address frame, int flags); 65 void (* mapping_remove)(as_t *as, __address page); 65 66 pte_t *(* mapping_find)(as_t *as, __address page); 66 67 }; … … 71 72 extern void page_init(void); 72 73 extern void page_mapping_insert(as_t *as, __address page, __address frame, int flags); 74 extern void page_mapping_remove(as_t *as, __address page); 73 75 extern pte_t *page_mapping_find(as_t *as, __address page); 74 76 extern pte_t *page_table_create(int flags); -
generic/src/mm/page.c
rbfb87df r8f00329 72 72 } 73 73 74 /** Map page to frame74 /** Insert mapping of page to frame. 75 75 * 76 76 * Map virtual address 'page' to physical address 'frame' … … 79 79 * The address space must be locked and interrupts must be disabled. 80 80 * 81 * @param as Address space to wich page belongs. .81 * @param as Address space to wich page belongs. 82 82 * @param page Virtual address of the page to be mapped. 83 83 * @param frame Physical address of memory frame to which the mapping is done. … … 90 90 91 91 page_mapping_operations->mapping_insert(as, page, frame, flags); 92 } 93 94 /** Remove mapping of page. 95 * 96 * Remove any mapping of 'page' within address space 'as'. 97 * TLB shootdown should follow in order to make effects of 98 * this call visible. 99 * 100 * The address space must be locked and interrupts must be disabled. 101 * 102 * @param as Address space to wich page belongs. 103 * @param page Virtual address of the page to be demapped. 104 */ 105 void page_mapping_remove(as_t *as, __address page) 106 { 107 ASSERT(page_mapping_operations); 108 ASSERT(page_mapping_operations->mapping_remove); 109 110 page_mapping_operations->mapping_remove(as, page); 92 111 } 93 112
Note:
See TracChangeset
for help on using the changeset viewer.