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