From 5f9a41e0378e749f52dde073d93a73dcd3a3a0f6 Mon Sep 17 00:00:00 2001 From: yamt Date: Sun, 20 Jan 2008 13:16:57 +0000 Subject: [PATCH] pmap_write_protect: fix an assumption in the previous. a pte can have PG_M even if it currently doesn't have PG_RW. --- sys/arch/x86/x86/pmap.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/arch/x86/x86/pmap.c b/sys/arch/x86/x86/pmap.c index 1ec429696fef..46a2c5b1a428 100644 --- a/sys/arch/x86/x86/pmap.c +++ b/sys/arch/x86/x86/pmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.37 2008/01/20 12:58:00 yamt Exp $ */ +/* $NetBSD: pmap.c,v 1.38 2008/01/20 13:16:57 yamt Exp $ */ /* * Copyright (c) 2007 Manuel Bouyer. @@ -154,7 +154,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.37 2008/01/20 12:58:00 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.38 2008/01/20 13:16:57 yamt Exp $"); #include "opt_user_ldt.h" #include "opt_lockdebug.h" @@ -3431,7 +3431,7 @@ pmap_write_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot) do { opte = *spte; if ((~opte & (PG_RW | PG_V)) != 0) { - break; + goto next; } npte = opte & ~PG_RW; } while (pmap_pte_cas(spte, opte, npte) != opte); @@ -3441,6 +3441,7 @@ pmap_write_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot) tva = x86_ptob(spte - ptes); pmap_tlb_shootdown(pmap, tva, 0, opte); } +next:; } }