Date: Tue, 19 Nov 2013 23:37:50 +0000 (UTC) From: Zbigniew Bodek <zbb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r258359 - head/sys/arm/arm Message-ID: <201311192337.rAJNbo4A025942@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: zbb Date: Tue Nov 19 23:37:50 2013 New Revision: 258359 URL: http://svnweb.freebsd.org/changeset/base/258359 Log: Apply access flags for managed and unmanaged pages properly on ARMv6/v7 When entering a mapping via pmap_enter() unmanaged pages ought to be naturally excluded from the "modified" and "referenced" emulation. RW permission should be granted implicitly when requested, otherwise unmanaged page will not recover from the permission fault since there will be no PV entry to indicate that the page can be written. In addition, only managed pages that participate in "modified" emulation need to be marked as "dirty" and "writeable" when entered with RW permissions. Likewise with "referenced" flag for managed pages. Unmanaged ones however should not be marked as such. Reviewed by: cognet, gber Modified: head/sys/arm/arm/pmap-v6.c Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Tue Nov 19 23:31:39 2013 (r258358) +++ head/sys/arm/arm/pmap-v6.c Tue Nov 19 23:37:50 2013 (r258359) @@ -3079,36 +3079,38 @@ validate: * then continue setting mapping parameters */ if (m != NULL) { - if (prot & (VM_PROT_ALL)) { - if ((m->oflags & VPO_UNMANAGED) == 0) + if ((m->oflags & VPO_UNMANAGED) == 0) { + if (prot & (VM_PROT_ALL)) { vm_page_aflag_set(m, PGA_REFERENCED); - } else { - /* - * Need to do page referenced emulation. - */ - npte &= ~L2_S_REF; + } else { + /* + * Need to do page referenced emulation. + */ + npte &= ~L2_S_REF; + } } if (prot & VM_PROT_WRITE) { - /* - * 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); /* - * The access type and permissions indicate - * that the page will be written as soon as - * returned from fault service. - * Mark it dirty from the outset. + * Enable write permission if the access type + * indicates write intention. Emulate modified + * bit otherwise. */ - if ((access & VM_PROT_WRITE) != 0) + if ((access & VM_PROT_WRITE) != 0) { + npte &= ~(L2_APX); + vm_page_aflag_set(m, PGA_WRITEABLE); + /* + * The access type and permissions + * indicate that the page will be + * written as soon as returned from + * fault service. + * Mark it dirty from the outset. + */ vm_page_dirty(m); - } + } + } else + npte &= ~(L2_APX); } if (!(prot & VM_PROT_EXECUTE)) npte |= L2_XN;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311192337.rAJNbo4A025942>