* Remove the given range of addresses from the specified map. * * It is assumed that the start and end are properly * rounded to the page size. */
| 1840 | * rounded to the page size. |
| 1841 | */ |
| 1842 | void |
| 1843 | pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) |
| 1844 | { |
| 1845 | pd_entry_t *pde, *pdpe; |
| 1846 | pt_entry_t *pte; |
| 1847 | vm_offset_t va_next; |
| 1848 | vm_offset_t va_init, va_fini; |
| 1849 | bool need_tlb_shootdown; |
| 1850 | |
| 1851 | /* |
| 1852 | * Perform an unsynchronized read. This is, however, safe. |
| 1853 | */ |
| 1854 | if (pmap->pm_stats.resident_count == 0) |
| 1855 | return; |
| 1856 | |
| 1857 | rw_wlock(&pvh_global_lock); |
| 1858 | PMAP_LOCK(pmap); |
| 1859 | |
| 1860 | /* |
| 1861 | * special handling of removing one page. a very common operation |
| 1862 | * and easy to short circuit some code. |
| 1863 | */ |
| 1864 | if ((sva + PAGE_SIZE) == eva) { |
| 1865 | pmap_remove_page(pmap, sva); |
| 1866 | goto out; |
| 1867 | } |
| 1868 | for (; sva < eva; sva = va_next) { |
| 1869 | pdpe = pmap_segmap(pmap, sva); |
| 1870 | #ifdef __mips_n64 |
| 1871 | if (*pdpe == 0) { |
| 1872 | va_next = (sva + NBSEG) & ~SEGMASK; |
| 1873 | if (va_next < sva) |
| 1874 | va_next = eva; |
| 1875 | continue; |
| 1876 | } |
| 1877 | #endif |
| 1878 | |
| 1879 | /* Scan up to the end of the page table pointed to by pde */ |
| 1880 | va_next = (sva + NBPDR) & ~PDRMASK; |
| 1881 | if (va_next < sva) |
| 1882 | va_next = eva; |
| 1883 | |
| 1884 | pde = pmap_pdpe_to_pde(pdpe, sva); |
| 1885 | if (*pde == NULL) |
| 1886 | continue; |
| 1887 | |
| 1888 | /* |
| 1889 | * Limit our scan to either the end of the va represented |
| 1890 | * by the current page table page, or to the end of the |
| 1891 | * range being removed. |
| 1892 | */ |
| 1893 | if (va_next > eva) |
| 1894 | va_next = eva; |
| 1895 | |
| 1896 | need_tlb_shootdown = false; |
| 1897 | va_init = sva; |
| 1898 | va_fini = va_next; |
| 1899 | for (pte = pmap_pde_to_pte(pde, sva); sva != va_next; pte++, |
no test coverage detected