diff --git a/sys/arm/arm/pmap.c b/sys/arm/arm/pmap.c index cd8a56228320..a375987bfc83 100644 --- a/sys/arm/arm/pmap.c +++ b/sys/arm/arm/pmap.c @@ -3412,7 +3412,8 @@ pmap_enter_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, if (prot & VM_PROT_WRITE) { npte |= L2_S_PROT_W; - if (m != NULL) + if (m != NULL && + (m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) vm_page_flag_set(m, PG_WRITEABLE); } npte |= pte_l2_s_cache_mode; diff --git a/sys/powerpc/booke/pmap.c b/sys/powerpc/booke/pmap.c index ca48adc0d851..4bc5e93b5f4b 100644 --- a/sys/powerpc/booke/pmap.c +++ b/sys/powerpc/booke/pmap.c @@ -1596,7 +1596,8 @@ mmu_booke_enter_locked(mmu_t mmu, pmap_t pmap, vm_offset_t va, vm_page_t m, if (!su) flags |= PTE_UW; - vm_page_flag_set(m, PG_WRITEABLE); + if ((flags & PTE_MANAGED) != 0) + vm_page_flag_set(m, PG_WRITEABLE); } else { /* Handle modified pages, sense modify status. */ @@ -1662,7 +1663,8 @@ mmu_booke_enter_locked(mmu_t mmu, pmap_t pmap, vm_offset_t va, vm_page_t m, if (!su) flags |= PTE_UW; - vm_page_flag_set(m, PG_WRITEABLE); + if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) + vm_page_flag_set(m, PG_WRITEABLE); } if (prot & VM_PROT_EXECUTE) { diff --git a/sys/sparc64/sparc64/pmap.c b/sys/sparc64/sparc64/pmap.c index 719fb3b9147e..7769bdc24ce1 100644 --- a/sys/sparc64/sparc64/pmap.c +++ b/sys/sparc64/sparc64/pmap.c @@ -1409,7 +1409,8 @@ pmap_enter_locked(pmap_t pm, vm_offset_t va, vm_page_t m, vm_prot_t prot, tp->tte_data |= TD_SW; if (wired) tp->tte_data |= TD_W; - vm_page_flag_set(m, PG_WRITEABLE); + if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) + vm_page_flag_set(m, PG_WRITEABLE); } else if ((data & TD_W) != 0) vm_page_dirty(m); @@ -1429,7 +1430,7 @@ pmap_enter_locked(pmap_t pm, vm_offset_t va, vm_page_t m, vm_prot_t prot, } else { /* * If there is an existing mapping, but its for a different - * phsyical address, delete the old mapping. + * physical address, delete the old mapping. */ if (tp != NULL) { CTR0(KTR_PMAP, "pmap_enter_locked: replace"); @@ -1449,7 +1450,8 @@ pmap_enter_locked(pmap_t pm, vm_offset_t va, vm_page_t m, vm_prot_t prot, data |= TD_P; if ((prot & VM_PROT_WRITE) != 0) { data |= TD_SW; - vm_page_flag_set(m, PG_WRITEABLE); + if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) + vm_page_flag_set(m, PG_WRITEABLE); } if (prot & VM_PROT_EXECUTE) { data |= TD_EXEC;