svn commit: r340029 - head/sys/riscv/riscv
John Baldwin
jhb at FreeBSD.org
Thu Nov 1 22:17:52 UTC 2018
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)
More information about the svn-src-all
mailing list