Date: Thu, 1 Nov 2018 22:17:51 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r340029 - head/sys/riscv/riscv Message-ID: <201811012217.wA1MHpB7033729@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Thu Nov 1 22:17:51 2018 New Revision: 340029 URL: https://svnweb.freebsd.org/changeset/base/340029 Log: Set PTE_A and PTE_D for user mappings in pmap_enter(). This assumes that an access according to the prot in 'flags' triggered a fault and is going to be retried after the fault returns, so the two flags are set preemptively to avoid refaulting on the retry. While here, only bother setting PTE_D for kernel mappings in pmap_enter for writable mappings. Reviewed by: markj Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D17782 Modified: head/sys/riscv/riscv/pmap.c Modified: head/sys/riscv/riscv/pmap.c ============================================================================== --- head/sys/riscv/riscv/pmap.c Thu Nov 1 22:15:25 2018 (r340028) +++ head/sys/riscv/riscv/pmap.c Thu Nov 1 22:17:51 2018 (r340029) @@ -2088,13 +2088,15 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v pa = VM_PAGE_TO_PHYS(m); pn = (pa / PAGE_SIZE); - new_l3 = PTE_V | PTE_R | PTE_X; + new_l3 = PTE_V | PTE_R | PTE_X | PTE_A; + if (flags & VM_PROT_WRITE) + new_l3 |= PTE_D; if (prot & VM_PROT_WRITE) new_l3 |= PTE_W; if ((va >> 63) == 0) new_l3 |= PTE_U; - else - new_l3 |= PTE_A | PTE_D; + else if (prot & VM_PROT_WRITE) + new_l3 |= PTE_D; new_l3 |= (pn << PTE_PPN0_S); if ((flags & PMAP_ENTER_WIRED) != 0)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811012217.wA1MHpB7033729>