MCPcopy Create free account
hub / github.com/F-Stack/f-stack / pmap_remove

Function pmap_remove

freebsd/mips/mips/pmap.c:1842–1937  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

1840 * rounded to the page size.
1841 */
1842void
1843pmap_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++,

Callers 7

pmap_protectFunction · 0.70
vm_map_syncFunction · 0.50
vm_map_deleteFunction · 0.50
_kmem_unbackFunction · 0.50
kmem_bootstrap_freeFunction · 0.50
startup_freeFunction · 0.50

Calls 6

pmap_segmapFunction · 0.85
pmap_remove_pageFunction · 0.70
pmap_pdpe_to_pdeFunction · 0.70
pmap_pde_to_pteFunction · 0.70
pmap_remove_pteFunction · 0.70
pmap_invalidate_rangeFunction · 0.70

Tested by

no test coverage detected