Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Jul 2013 10:38:14 +0000 (UTC)
From:      Grzegorz Bernacki <gber@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r252694 - head/sys/arm/arm
Message-ID:  <201307041038.r64AcEUa059226@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gber
Date: Thu Jul  4 10:38:14 2013
New Revision: 252694
URL: http://svnweb.freebsd.org/changeset/base/252694

Log:
  Fix modified bit emulation for ARMv6/v7
  
  When doing pmap_enter_locked(), enable write permission only when access
  type indicates attempt to write. Otherwise, leave the page read only but
  mark it writable in pv_flags.
  
  This will result in:
  1. Marking page writable during pmap_enter() but only when ensured that it
     will be written right away so that we will not get redundant permissions
     fault on write attempt.
  2. Keeping page read only when it is permitted to be written but there was
     no actual write attempt. Hence, we will get permissions fault on write
     access and mark page writable in pmap_fault_fixup() what will indicate
     modification status.
  
  Submitted by:   Zbigniew Bodek <zbb@semihalf.com>
  Sponsored by:   The FreeBSD Foundation, Semihalf

Modified:
  head/sys/arm/arm/pmap-v6.c

Modified: head/sys/arm/arm/pmap-v6.c
==============================================================================
--- head/sys/arm/arm/pmap-v6.c	Thu Jul  4 08:59:34 2013	(r252693)
+++ head/sys/arm/arm/pmap-v6.c	Thu Jul  4 10:38:14 2013	(r252694)
@@ -2801,8 +2801,13 @@ validate:
 		}
 
 		if (prot & VM_PROT_WRITE) {
-			/* Write enable */
-			npte &= ~(L2_APX);
+			/*
+			 * Enable write permission if the access type
+			 * indicates write intention. Emulate modified
+			 * bit otherwise.
+			 */
+			if ((access & VM_PROT_WRITE) != 0)
+				npte &= ~(L2_APX);
 
 			if ((m->oflags & VPO_UNMANAGED) == 0) {
 				vm_page_aflag_set(m, PGA_WRITEABLE);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307041038.r64AcEUa059226>