Changes in kernel/genarch/src/mm/page_pt.c [17af882:346b12a2] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/mm/page_pt.c
r17af882 r346b12a2 53 53 static void pt_mapping_insert(as_t *, uintptr_t, uintptr_t, unsigned int); 54 54 static void pt_mapping_remove(as_t *, uintptr_t); 55 static pte_t *pt_mapping_find(as_t *, uintptr_t, bool); 55 static bool pt_mapping_find(as_t *, uintptr_t, bool, pte_t *pte); 56 static void pt_mapping_update(as_t *, uintptr_t, bool, pte_t *pte); 56 57 static void pt_mapping_make_global(uintptr_t, size_t); 57 58 … … 60 61 .mapping_remove = pt_mapping_remove, 61 62 .mapping_find = pt_mapping_find, 63 .mapping_update = pt_mapping_update, 62 64 .mapping_make_global = pt_mapping_make_global 63 65 }; … … 289 291 } 290 292 291 /** Find mapping for virtual page in hierarchical page tables. 292 * 293 * @param as Address space to which page belongs. 294 * @param page Virtual page. 295 * @param nolock True if the page tables need not be locked. 296 * 297 * @return NULL if there is no such mapping; entry from PTL3 describing 298 * the mapping otherwise. 299 * 300 */ 301 pte_t *pt_mapping_find(as_t *as, uintptr_t page, bool nolock) 293 static pte_t *pt_mapping_find_internal(as_t *as, uintptr_t page, bool nolock) 302 294 { 303 295 ASSERT(nolock || page_table_locked(as)); … … 334 326 335 327 return &ptl3[PTL3_INDEX(page)]; 328 } 329 330 /** Find mapping for virtual page in hierarchical page tables. 331 * 332 * @param as Address space to which page belongs. 333 * @param page Virtual page. 334 * @param nolock True if the page tables need not be locked. 335 * @param[out] pte Structure that will receive a copy of the found PTE. 336 * 337 * @return True if the mapping was found, false otherwise. 338 */ 339 bool pt_mapping_find(as_t *as, uintptr_t page, bool nolock, pte_t *pte) 340 { 341 pte_t *t = pt_mapping_find_internal(as, page, nolock); 342 if (t) 343 *pte = *t; 344 return t != NULL; 345 } 346 347 /** Update mapping for virtual page in hierarchical page tables. 348 * 349 * @param as Address space to which page belongs. 350 * @param page Virtual page. 351 * @param nolock True if the page tables need not be locked. 352 * @param[in] pte New PTE. 353 */ 354 void pt_mapping_update(as_t *as, uintptr_t page, bool nolock, pte_t *pte) 355 { 356 pte_t *t = pt_mapping_find_internal(as, page, nolock); 357 if (!t) 358 panic("Updating non-existent PTE"); 359 360 ASSERT(PTE_VALID(t) == PTE_VALID(pte)); 361 ASSERT(PTE_PRESENT(t) == PTE_PRESENT(pte)); 362 ASSERT(PTE_GET_FRAME(t) == PTE_GET_FRAME(pte)); 363 ASSERT(PTE_WRITABLE(t) == PTE_WRITABLE(pte)); 364 ASSERT(PTE_EXECUTABLE(t) == PTE_EXECUTABLE(pte)); 365 366 *t = *pte; 336 367 } 337 368
Note:
See TracChangeset
for help on using the changeset viewer.