Module Name:    src
Committed By:   ryo
Date:           Sun May 20 06:45:00 UTC 2018

Modified Files:
        src/sys/arch/aarch64/aarch64: pmap.c

Log Message:
pmap_enter() must update modified/referenced flags by 'flags' not 'prot'.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/aarch64/aarch64/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/aarch64/aarch64/pmap.c
diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.6 src/sys/arch/aarch64/aarch64/pmap.c:1.7
--- src/sys/arch/aarch64/aarch64/pmap.c:1.6	Wed May 16 08:32:07 2018
+++ src/sys/arch/aarch64/aarch64/pmap.c	Sun May 20 06:45:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.6 2018/05/16 08:32:07 ryo Exp $	*/
+/*	$NetBSD: pmap.c,v 1.7 2018/05/20 06:45:00 ryo Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu <r...@nerv.org>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.6 2018/05/16 08:32:07 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.7 2018/05/20 06:45:00 ryo Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -1436,17 +1436,10 @@ _pmap_enter(struct pmap *pm, vaddr_t va,
 			    "pmap_enter: failed to allocate pv_entry");
 		}
 
-		if (flags & PMAP_WIRED) {
-			/*
-			 * initial value of ref/mod are equal to prot,
-			 * and pte RW are same as prot.
-			 */
-			VM_PAGE_TO_MD(pg)->mdpg_flags |=
-			    (prot & mdattr);
-		} else {
-			/* pte RW will be masked by ref/mod for ref/mod emul */
-			mdattr &= VM_PAGE_TO_MD(pg)->mdpg_flags;
-		}
+		/* update referenced/modified flags */
+		VM_PAGE_TO_MD(pg)->mdpg_flags |=
+		    (flags & (VM_PROT_READ | VM_PROT_WRITE));
+		mdattr &= VM_PAGE_TO_MD(pg)->mdpg_flags;
 	}
 
 #ifdef PMAPCOUNTERS

Reply via email to