diff options
author | alc <alc@FreeBSD.org> | 2004-06-20 06:11:00 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2004-06-20 06:11:00 +0000 |
commit | d711478366fb98d9f5712539d1662be350da961e (patch) | |
tree | 12ca948005e6b1a3c5f354639c5e25a423e9abe8 | |
parent | da4e7c693b9265024d10655fef30c50246311b0c (diff) | |
download | FreeBSD-src-d711478366fb98d9f5712539d1662be350da961e.zip FreeBSD-src-d711478366fb98d9f5712539d1662be350da961e.tar.gz |
Add pmap locking to pmap_is_prefaultable().
-rw-r--r-- | sys/amd64/amd64/pmap.c | 15 | ||||
-rw-r--r-- | sys/i386/i386/pmap.c | 15 |
2 files changed, 18 insertions, 12 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 62a91a6..d974c88 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -2566,14 +2566,17 @@ pmap_is_prefaultable(pmap_t pmap, vm_offset_t addr) { pd_entry_t *pde; pt_entry_t *pte; + boolean_t rv; + rv = FALSE; + PMAP_LOCK(pmap); pde = pmap_pde(pmap, addr); - if (pde == NULL || (*pde & PG_V) == 0) - return (FALSE); - pte = vtopte(addr); - if (*pte & PG_V) - return (FALSE); - return (TRUE); + if (pde != NULL && (*pde & PG_V)) { + pte = vtopte(addr); + rv = (*pte & PG_V) == 0; + } + PMAP_UNLOCK(pmap); + return (rv); } /* diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index e115938..f9027db 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -2641,13 +2641,16 @@ boolean_t pmap_is_prefaultable(pmap_t pmap, vm_offset_t addr) { pt_entry_t *pte; + boolean_t rv; - if ((*pmap_pde(pmap, addr)) == 0) - return (FALSE); - pte = vtopte(addr); - if (*pte) - return (FALSE); - return (TRUE); + rv = FALSE; + PMAP_LOCK(pmap); + if (*pmap_pde(pmap, addr)) { + pte = vtopte(addr); + rv = *pte == 0; + } + PMAP_UNLOCK(pmap); + return (rv); } /* |