mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-14 10:09:48 +00:00
Only extract a physical address from a pte in pmap_extract() if the pte is
valid. Implement the protection check required by the pmap_extract_and_hold() specification. (This enables the elimination of Giant from that function.)
This commit is contained in:
parent
d8582da660
commit
4a28f15ccd
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=132338
@ -751,8 +751,8 @@ pmap_extract(pmap_t pmap, vm_offset_t va)
|
||||
return (pa);
|
||||
PMAP_LOCK(pmap);
|
||||
pte = pmap_lev3pte(pmap, va);
|
||||
if (pte != NULL)
|
||||
pa = alpha_ptob(ALPHA_PTE_TO_PFN(*pte));
|
||||
if (pte != NULL && pmap_pte_v(pte))
|
||||
pa = pmap_pte_pa(pte);
|
||||
PMAP_UNLOCK(pmap);
|
||||
return (pa);
|
||||
}
|
||||
@ -767,18 +767,22 @@ pmap_extract(pmap_t pmap, vm_offset_t va)
|
||||
vm_page_t
|
||||
pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot)
|
||||
{
|
||||
vm_paddr_t pa;
|
||||
pt_entry_t *pte;
|
||||
vm_page_t m;
|
||||
|
||||
m = NULL;
|
||||
mtx_lock(&Giant);
|
||||
if ((pa = pmap_extract(pmap, va)) != 0) {
|
||||
m = PHYS_TO_VM_PAGE(pa);
|
||||
vm_page_lock_queues();
|
||||
if (pmap == NULL)
|
||||
return (m);
|
||||
vm_page_lock_queues();
|
||||
PMAP_LOCK(pmap);
|
||||
pte = pmap_lev3pte(pmap, va);
|
||||
if (pte != NULL && pmap_pte_v(pte) &&
|
||||
(*pte & pte_prot(pmap, prot)) == pte_prot(pmap, prot)) {
|
||||
m = PHYS_TO_VM_PAGE(pmap_pte_pa(pte));
|
||||
vm_page_hold(m);
|
||||
vm_page_unlock_queues();
|
||||
}
|
||||
mtx_unlock(&Giant);
|
||||
vm_page_unlock_queues();
|
||||
PMAP_UNLOCK(pmap);
|
||||
return (m);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user