From 337e8857684ec536aa35cab907dfc2ae65674554 Mon Sep 17 00:00:00 2001 From: dyson Date: Sat, 11 Jan 1997 23:50:42 +0000 Subject: 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. --- sys/amd64/amd64/pmap.c | 21 +++++++++++++-------- sys/i386/i386/pmap.c | 21 +++++++++++++-------- 2 files changed, 26 insertions(+), 16 deletions(-) (limited to 'sys') 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; } -- cgit v1.1