* Release any resources held by the given physical map. * Called when a pmap initialized by pmap_pinit is being released. * Should only be called if the map contains no valid mappings. */
| 2315 | * Should only be called if the map contains no valid mappings. |
| 2316 | */ |
| 2317 | void |
| 2318 | pmap_release(pmap_t pmap) |
| 2319 | { |
| 2320 | #ifdef INVARIANTS |
| 2321 | vm_offset_t start, end; |
| 2322 | #endif |
| 2323 | KASSERT(pmap->pm_stats.resident_count == 0, |
| 2324 | ("%s: pmap resident count %ld != 0", __func__, |
| 2325 | pmap->pm_stats.resident_count)); |
| 2326 | KASSERT(pt2tab_user_is_empty(pmap->pm_pt2tab), |
| 2327 | ("%s: has allocated user PT2(s)", __func__)); |
| 2328 | KASSERT(CPU_EMPTY(&pmap->pm_active), |
| 2329 | ("%s: pmap %p is active on some CPU(s)", __func__, pmap)); |
| 2330 | |
| 2331 | mtx_lock_spin(&allpmaps_lock); |
| 2332 | LIST_REMOVE(pmap, pm_list); |
| 2333 | mtx_unlock_spin(&allpmaps_lock); |
| 2334 | |
| 2335 | #ifdef INVARIANTS |
| 2336 | start = pte1_index(KERNBASE) * sizeof(pt1_entry_t); |
| 2337 | end = (pte1_index(0xFFFFFFFF) + 1) * sizeof(pt1_entry_t); |
| 2338 | bzero((char *)pmap->pm_pt1 + start, end - start); |
| 2339 | |
| 2340 | start = pt2tab_index(KERNBASE) * sizeof(pt2_entry_t); |
| 2341 | end = (pt2tab_index(0xFFFFFFFF) + 1) * sizeof(pt2_entry_t); |
| 2342 | bzero((char *)pmap->pm_pt2tab + start, end - start); |
| 2343 | #endif |
| 2344 | /* |
| 2345 | * We are leaving PT1 and PT2TAB allocated on released pmap, |
| 2346 | * so hopefully UMA vmspace_zone will always be inited with |
| 2347 | * UMA_ZONE_NOFREE flag. |
| 2348 | */ |
| 2349 | } |
| 2350 | |
| 2351 | /********************************************************* |
| 2352 | * |
nothing calls this directly
no test coverage detected