From cc793cafa6c6314c264c58a78e10ac5942fd67de Mon Sep 17 00:00:00 2001 From: grehan Date: Thu, 5 Aug 2004 12:44:12 +0000 Subject: In pmap_page_protect, clear the vm page's PG_WRITEABLE flag if downgrading to read-only. Found by triggering the KASSERT in vm_pageout_flush(). --- sys/powerpc/aim/mmu_oea.c | 8 +++++++- sys/powerpc/powerpc/mmu_oea.c | 8 +++++++- sys/powerpc/powerpc/pmap.c | 8 +++++++- 3 files changed, 21 insertions(+), 3 deletions(-) (limited to 'sys') diff --git a/sys/powerpc/aim/mmu_oea.c b/sys/powerpc/aim/mmu_oea.c index 2225cf1..62bdcec 100644 --- a/sys/powerpc/aim/mmu_oea.c +++ b/sys/powerpc/aim/mmu_oea.c @@ -1350,6 +1350,12 @@ pmap_page_protect(vm_page_t m, vm_prot_t prot) pmap_pte_change(pt, &pvo->pvo_pte, pvo->pvo_vaddr); PMAP_PVO_CHECK(pvo); /* sanity check */ } + + /* + * Downgrading from writeable: clear the VM page flag + */ + if ((prot & VM_PROT_WRITE) != VM_PROT_WRITE) + vm_page_flag_clear(m, PG_WRITEABLE); } /* @@ -1583,7 +1589,7 @@ pmap_remove_all(vm_page_t m) pvo_head = vm_page_to_pvoh(m); for (pvo = LIST_FIRST(pvo_head); pvo != NULL; pvo = next_pvo) { next_pvo = LIST_NEXT(pvo, pvo_vlink); - + PMAP_PVO_CHECK(pvo); /* sanity check */ pmap_pvo_remove(pvo, -1); } diff --git a/sys/powerpc/powerpc/mmu_oea.c b/sys/powerpc/powerpc/mmu_oea.c index 2225cf1..62bdcec 100644 --- a/sys/powerpc/powerpc/mmu_oea.c +++ b/sys/powerpc/powerpc/mmu_oea.c @@ -1350,6 +1350,12 @@ pmap_page_protect(vm_page_t m, vm_prot_t prot) pmap_pte_change(pt, &pvo->pvo_pte, pvo->pvo_vaddr); PMAP_PVO_CHECK(pvo); /* sanity check */ } + + /* + * Downgrading from writeable: clear the VM page flag + */ + if ((prot & VM_PROT_WRITE) != VM_PROT_WRITE) + vm_page_flag_clear(m, PG_WRITEABLE); } /* @@ -1583,7 +1589,7 @@ pmap_remove_all(vm_page_t m) pvo_head = vm_page_to_pvoh(m); for (pvo = LIST_FIRST(pvo_head); pvo != NULL; pvo = next_pvo) { next_pvo = LIST_NEXT(pvo, pvo_vlink); - + PMAP_PVO_CHECK(pvo); /* sanity check */ pmap_pvo_remove(pvo, -1); } diff --git a/sys/powerpc/powerpc/pmap.c b/sys/powerpc/powerpc/pmap.c index 2225cf1..62bdcec 100644 --- a/sys/powerpc/powerpc/pmap.c +++ b/sys/powerpc/powerpc/pmap.c @@ -1350,6 +1350,12 @@ pmap_page_protect(vm_page_t m, vm_prot_t prot) pmap_pte_change(pt, &pvo->pvo_pte, pvo->pvo_vaddr); PMAP_PVO_CHECK(pvo); /* sanity check */ } + + /* + * Downgrading from writeable: clear the VM page flag + */ + if ((prot & VM_PROT_WRITE) != VM_PROT_WRITE) + vm_page_flag_clear(m, PG_WRITEABLE); } /* @@ -1583,7 +1589,7 @@ pmap_remove_all(vm_page_t m) pvo_head = vm_page_to_pvoh(m); for (pvo = LIST_FIRST(pvo_head); pvo != NULL; pvo = next_pvo) { next_pvo = LIST_NEXT(pvo, pvo_vlink); - + PMAP_PVO_CHECK(pvo); /* sanity check */ pmap_pvo_remove(pvo, -1); } -- cgit v1.1