diff options
author | dyson <dyson@FreeBSD.org> | 1997-01-11 23:50:42 +0000 |
---|---|---|
committer | dyson <dyson@FreeBSD.org> | 1997-01-11 23:50:42 +0000 |
commit | 337e8857684ec536aa35cab907dfc2ae65674554 (patch) | |
tree | 69b1ac39203fbce375da9bb406d4bfdb5d2e7984 /sys | |
parent | 5c2428f158984828b4f1f9fcfa958d73e89e354a (diff) | |
download | FreeBSD-src-337e8857684ec536aa35cab907dfc2ae65674554.zip FreeBSD-src-337e8857684ec536aa35cab907dfc2ae65674554.tar.gz |
When we changed pmap_protect to support adding the writeable
attribute to a page range, we forgot to set the PG_WRITEABLE
flag in the vm_page_t. This fixes that problem.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/amd64/pmap.c | 21 | ||||
-rw-r--r-- | sys/i386/i386/pmap.c | 21 |
2 files changed, 26 insertions, 16 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index ea3ea43..c2b800d 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -39,7 +39,7 @@ * SUCH DAMAGE. * * from: @(#)pmap.c 7.7 (Berkeley) 5/12/91 - * $Id: pmap.c,v 1.132 1996/12/29 02:27:07 dyson Exp $ + * $Id: pmap.c,v 1.133 1997/01/11 07:19:02 dyson Exp $ */ /* @@ -1863,15 +1863,20 @@ pmap_protect(pmap, sva, eva, prot) unsigned pbits = ptbase[sindex]; - if (prot & VM_PROT_WRITE) { - if ((pbits & (PG_RW|PG_V)) == PG_V) { - ptbase[sindex] = pbits | PG_RW; - anychanged = 1; - } - } else if (pbits & PG_RW) { + if (prot & VM_PROT_WRITE) { + if ((pbits & (PG_RW|PG_V)) == PG_V) { + if (pbits & PG_MANAGED) { + vm_page_t m = PHYS_TO_VM_PAGE(pbits); + m->flags |= PG_WRITEABLE; + m->object->flags |= OBJ_WRITEABLE|OBJ_MIGHTBEDIRTY; + } + ptbase[sindex] = pbits | PG_RW; + anychanged = 1; + } + } else if (pbits & PG_RW) { if (pbits & PG_M) { vm_offset_t sva = i386_ptob(sindex); - if (pmap_track_modified(sva)) { + if ((pbits & PG_MANAGED) && pmap_track_modified(sva)) { vm_page_t m = PHYS_TO_VM_PAGE(pbits); m->dirty = VM_PAGE_BITS_ALL; } diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index ea3ea43..c2b800d 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -39,7 +39,7 @@ * SUCH DAMAGE. * * from: @(#)pmap.c 7.7 (Berkeley) 5/12/91 - * $Id: pmap.c,v 1.132 1996/12/29 02:27:07 dyson Exp $ + * $Id: pmap.c,v 1.133 1997/01/11 07:19:02 dyson Exp $ */ /* @@ -1863,15 +1863,20 @@ pmap_protect(pmap, sva, eva, prot) unsigned pbits = ptbase[sindex]; - if (prot & VM_PROT_WRITE) { - if ((pbits & (PG_RW|PG_V)) == PG_V) { - ptbase[sindex] = pbits | PG_RW; - anychanged = 1; - } - } else if (pbits & PG_RW) { + if (prot & VM_PROT_WRITE) { + if ((pbits & (PG_RW|PG_V)) == PG_V) { + if (pbits & PG_MANAGED) { + vm_page_t m = PHYS_TO_VM_PAGE(pbits); + m->flags |= PG_WRITEABLE; + m->object->flags |= OBJ_WRITEABLE|OBJ_MIGHTBEDIRTY; + } + ptbase[sindex] = pbits | PG_RW; + anychanged = 1; + } + } else if (pbits & PG_RW) { if (pbits & PG_M) { vm_offset_t sva = i386_ptob(sindex); - if (pmap_track_modified(sva)) { + if ((pbits & PG_MANAGED) && pmap_track_modified(sva)) { vm_page_t m = PHYS_TO_VM_PAGE(pbits); m->dirty = VM_PAGE_BITS_ALL; } |