Date: Thu, 3 Jan 2019 16:19:33 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r342733 - head/sys/riscv/riscv Message-ID: <201901031619.x03GJXB4038151@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Thu Jan 3 16:19:32 2019 New Revision: 342733 URL: https://svnweb.freebsd.org/changeset/base/342733 Log: Set PTE_U on PTEs created by pmap_enter_quick(). Otherwise prefaulted entries are not accessible from user mode and end up triggering a fault upon access, so prefaulting has no effect. Reviewed by: jhb, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D18718 Modified: head/sys/riscv/riscv/pmap.c Modified: head/sys/riscv/riscv/pmap.c ============================================================================== --- head/sys/riscv/riscv/pmap.c Thu Jan 3 16:15:28 2019 (r342732) +++ head/sys/riscv/riscv/pmap.c Thu Jan 3 16:19:32 2019 (r342733) @@ -2365,19 +2365,14 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v */ pmap_resident_count_inc(pmap, 1); - pa = VM_PAGE_TO_PHYS(m); - pn = (pa / PAGE_SIZE); - - entry = PTE_V | PTE_R; - if (prot & VM_PROT_EXECUTE) - entry |= PTE_X; - entry |= (pn << PTE_PPN0_S); - - /* - * Now validate mapping with RO protection - */ + newl3 = ((VM_PAGE_TO_PHYS(m) / PAGE_SIZE) << PTE_PPN0_S) | + PTE_V | PTE_R; + if ((prot & VM_PROT_EXECUTE) != 0) + newl3 |= PTE_X; if ((m->oflags & VPO_UNMANAGED) == 0) - entry |= PTE_SW_MANAGED; + newl3 |= PTE_SW_MANAGED; + if (va < VM_MAX_USER_ADDRESS) + newl3 |= PTE_U; /* * Sync the i-cache on all harts before updating the PTE @@ -2386,7 +2381,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v if (prot & VM_PROT_EXECUTE) pmap_sync_icache(pmap, va, PAGE_SIZE); - pmap_store(l3, entry); + pmap_store(l3, newl3); pmap_invalidate_page(pmap, va); return (mpte);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901031619.x03GJXB4038151>