Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Feb 2014 18:55:27 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r261803 - head/sys/arm/arm
Message-ID:  <201402121855.s1CItRO7032410@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ian
Date: Wed Feb 12 18:55:26 2014
New Revision: 261803
URL: http://svnweb.freebsd.org/changeset/base/261803

Log:
  On armv6 and later, use the WriteNotRead bit of the fault status register
  to decide what protections are required by the faulting access.  The old
  code disassembled the faulting instruction, and there are a lot of new
  instructions that aren't handled.  The old code is still used for armv4/5
  which doesn't have the WNR bit)

Modified:
  head/sys/arm/arm/trap.c

Modified: head/sys/arm/arm/trap.c
==============================================================================
--- head/sys/arm/arm/trap.c	Wed Feb 12 18:16:56 2014	(r261802)
+++ head/sys/arm/arm/trap.c	Wed Feb 12 18:55:26 2014	(r261803)
@@ -386,17 +386,16 @@ data_abort_handler(struct trapframe *tf)
 	}
 
 	/*
-	 * We need to know whether the page should be mapped
-	 * as R or R/W. The MMU does not give us the info as
-	 * to whether the fault was caused by a read or a write.
-	 *
-	 * However, we know that a permission fault can only be
-	 * the result of a write to a read-only location, so
-	 * we can deal with those quickly.
-	 *
-	 * Otherwise we need to disassemble the instruction
-	 * responsible to determine if it was a write.
+	 * We need to know whether the page should be mapped as R or R/W.  On
+	 * armv6 and later the fault status register indicates whether the
+	 * access was a read or write.  Prior to armv6, we know that a
+	 * permission fault can only be the result of a write to a read-only
+	 * location, so we can deal with those quickly.  Otherwise we need to
+	 * disassemble the faulting instruction to determine if it was a write.
 	 */
+#ifdef _ARM_ARCH_6
+	ftype = (fsr & FAULT_WNR) ? VM_PROT_READ | VM_PROT_WRITE : VM_PROT_READ;
+#else
 	if (IS_PERMISSION_FAULT(fsr))
 		ftype = VM_PROT_WRITE;
 	else {
@@ -412,6 +411,7 @@ data_abort_handler(struct trapframe *tf)
 			else
 				ftype = VM_PROT_READ;
 		}
+#endif
 	}
 
 	/*



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