Changes in kernel/generic/src/mm/page.c [560b81c:8cbf1c3] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/page.c
r560b81c r8cbf1c3 137 137 /** Find mapping for virtual page. 138 138 * 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 a valid PTE is returned, false otherwise. Note that 145 * the PTE is not guaranteed to be present. 146 */ 147 NO_TRACE bool page_mapping_find(as_t *as, uintptr_t page, bool nolock, 148 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 */ 147 NO_TRACE pte_t *page_mapping_find(as_t *as, uintptr_t page, bool nolock) 149 148 { 150 149 ASSERT(nolock || page_table_locked(as)); … … 154 153 155 154 return page_mapping_operations->mapping_find(as, 156 ALIGN_DOWN(page, PAGE_SIZE), nolock, pte); 157 } 158 159 /** Update mapping for virtual page. 160 * 161 * Use only to update accessed and modified/dirty bits. 162 * 163 * @param as Address space to which page belongs. 164 * @param page Virtual page. 165 * @param nolock True if the page tables need not be locked. 166 * @param pte New PTE. 167 */ 168 NO_TRACE void page_mapping_update(as_t *as, uintptr_t page, bool nolock, 169 pte_t *pte) 170 { 171 ASSERT(nolock || page_table_locked(as)); 172 173 ASSERT(page_mapping_operations); 174 ASSERT(page_mapping_operations->mapping_find); 175 176 page_mapping_operations->mapping_update(as, 177 ALIGN_DOWN(page, PAGE_SIZE), nolock, pte); 155 ALIGN_DOWN(page, PAGE_SIZE), nolock); 178 156 } 179 157 … … 195 173 page_table_lock(AS, true); 196 174 197 pte_t pte; 198 bool found = page_mapping_find(AS, virt, false, &pte); 199 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))) { 200 177 page_table_unlock(AS, true); 201 178 return ENOENT; 202 179 } 203 180 204 *phys = PTE_GET_FRAME( &pte) +181 *phys = PTE_GET_FRAME(pte) + 205 182 (virt - ALIGN_DOWN(virt, PAGE_SIZE)); 206 183
Note:
See TracChangeset
for help on using the changeset viewer.