svn commit: r342891 - in stable/12/sys: amd64/amd64 i386/i386
Mark Johnston
markj at FreeBSD.org
Wed Jan 9 17:39:16 UTC 2019
Author: markj
Date: Wed Jan 9 17:39:15 2019
New Revision: 342891
URL: https://svnweb.freebsd.org/changeset/base/342891
Log:
MFC r342686:
Avoid setting PG_U unconditionally in pmap_enter_quick_locked().
Modified:
stable/12/sys/amd64/amd64/pmap.c
stable/12/sys/i386/i386/pmap.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/amd64/amd64/pmap.c
==============================================================================
--- stable/12/sys/amd64/amd64/pmap.c Wed Jan 9 17:38:47 2019 (r342890)
+++ stable/12/sys/amd64/amd64/pmap.c Wed Jan 9 17:39:15 2019 (r342891)
@@ -5453,8 +5453,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v
vm_prot_t prot, vm_page_t mpte, struct rwlock **lockp)
{
struct spglist free;
- pt_entry_t *pte, PG_V;
- vm_paddr_t pa;
+ pt_entry_t newpte, *pte, PG_V;
KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva ||
(m->oflags & VPO_UNMANAGED) != 0,
@@ -5544,17 +5543,15 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v
*/
pmap_resident_count_inc(pmap, 1);
- pa = VM_PAGE_TO_PHYS(m) | pmap_cache_bits(pmap, m->md.pat_mode, 0);
+ newpte = VM_PAGE_TO_PHYS(m) | PG_V |
+ pmap_cache_bits(pmap, m->md.pat_mode, 0);
+ if ((m->oflags & VPO_UNMANAGED) == 0)
+ newpte |= PG_MANAGED;
if ((prot & VM_PROT_EXECUTE) == 0)
- pa |= pg_nx;
-
- /*
- * Now validate mapping with RO protection
- */
- if ((m->oflags & VPO_UNMANAGED) != 0)
- pte_store(pte, pa | PG_V | PG_U);
- else
- pte_store(pte, pa | PG_V | PG_U | PG_MANAGED);
+ newpte |= pg_nx;
+ if (va < VM_MAXUSER_ADDRESS)
+ newpte |= PG_U;
+ pte_store(pte, newpte);
return (mpte);
}
Modified: stable/12/sys/i386/i386/pmap.c
==============================================================================
--- stable/12/sys/i386/i386/pmap.c Wed Jan 9 17:38:47 2019 (r342890)
+++ stable/12/sys/i386/i386/pmap.c Wed Jan 9 17:39:15 2019 (r342891)
@@ -4095,8 +4095,7 @@ static vm_page_t
pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m,
vm_prot_t prot, vm_page_t mpte)
{
- pt_entry_t *pte;
- vm_paddr_t pa;
+ pt_entry_t newpte, *pte;
struct spglist free;
KASSERT(pmap != kernel_pmap || va < kmi.clean_sva ||
@@ -4179,19 +4178,17 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v
*/
pmap->pm_stats.resident_count++;
- pa = VM_PAGE_TO_PHYS(m) | pmap_cache_bits(pmap, m->md.pat_mode, 0);
+ newpte = VM_PAGE_TO_PHYS(m) | PG_V |
+ pmap_cache_bits(pmap, m->md.pat_mode, 0);
+ if ((m->oflags & VPO_UNMANAGED) == 0)
+ newpte |= PG_MANAGED;
#if defined(PAE) || defined(PAE_TABLES)
if ((prot & VM_PROT_EXECUTE) == 0)
- pa |= pg_nx;
+ newpte |= pg_nx;
#endif
-
- /*
- * Now validate mapping with RO protection
- */
- if ((m->oflags & VPO_UNMANAGED) != 0)
- pte_store(pte, pa | PG_V | PG_U);
- else
- pte_store(pte, pa | PG_V | PG_U | PG_MANAGED);
+ if (pmap != kernel_pmap)
+ newpte |= PG_U;
+ pte_store(pte, newpte);
sched_unpin();
return (mpte);
}
More information about the svn-src-all
mailing list