From owner-svn-src-head@FreeBSD.ORG Wed Feb 12 18:55:27 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4F9BF8E2; Wed, 12 Feb 2014 18:55:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 39BEB122B; Wed, 12 Feb 2014 18:55:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s1CItR6O032411; Wed, 12 Feb 2014 18:55:27 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s1CItRO7032410; Wed, 12 Feb 2014 18:55:27 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201402121855.s1CItRO7032410@svn.freebsd.org> From: Ian Lepore Date: Wed, 12 Feb 2014 18:55:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r261803 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Feb 2014 18:55:27 -0000 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 } /*