Changes in kernel/generic/src/mm/page.c [8cbf1c3:560b81c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/mm/page.c
r8cbf1c3 r560b81c 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 * 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) 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) 148 149 { 149 150 ASSERT(nolock || page_table_locked(as)); … … 153 154 154 155 return page_mapping_operations->mapping_find(as, 155 ALIGN_DOWN(page, PAGE_SIZE), nolock); 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); 156 178 } 157 179 … … 173 195 page_table_lock(AS, true); 174 196 175 pte_t *pte = page_mapping_find(AS, virt, false); 176 if ((!PTE_VALID(pte)) || (!PTE_PRESENT(pte))) { 197 pte_t pte; 198 bool found = page_mapping_find(AS, virt, false, &pte); 199 if (!found || !PTE_VALID(&pte) || !PTE_PRESENT(&pte)) { 177 200 page_table_unlock(AS, true); 178 201 return ENOENT; 179 202 } 180 203 181 *phys = PTE_GET_FRAME( pte) +204 *phys = PTE_GET_FRAME(&pte) + 182 205 (virt - ALIGN_DOWN(virt, PAGE_SIZE)); 183 206
Note:
See TracChangeset
for help on using the changeset viewer.