> Date: Thu, 28 Jul 2016 09:47:42 +0200
> From: Patrick Wildt <[email protected]>
>
> There is something I missed in the previous diff. When the PTE is not
> valid, the mapping behind the virtual address of course isn't valid.
> A flush to an unmapped page will give us a translation fault. So only
> flush if the page was active.
>
> ok?
I'm not sure this is right. If the page has been modified we may need
to flush the cache.
> diff --git a/sys/arch/arm/arm/pmap7.c b/sys/arch/arm/arm/pmap7.c
> index c341432..a43d110 100644
> --- a/sys/arch/arm/arm/pmap7.c
> +++ b/sys/arch/arm/arm/pmap7.c
> @@ -1132,7 +1132,7 @@ pmap_page_remove(struct vm_page *pg)
> struct l2_bucket *l2b;
> struct pv_entry *pv, *npv;
> pmap_t pm, curpm;
> - pt_entry_t *ptep, pte;
> + pt_entry_t *ptep;
> boolean_t flush;
>
> NPDEBUG(PDB_FOLLOW,
> @@ -1156,10 +1156,9 @@ pmap_page_remove(struct vm_page *pg)
>
> ptep = &l2b->l2b_kva[l2pte_index(pv->pv_va)];
> if (*ptep != 0) {
> - pte = *ptep;
> -
> /* inline pmap_is_current(pm) */
> - if (pm == curpm || pm == pmap_kernel()) {
> + if (l2pte_valid(*ptep) &&
> + (pm == curpm || pm == pmap_kernel())) {
> if (PV_BEEN_EXECD(pv->pv_flags))
> cpu_icache_sync_range(pv->pv_va,
> PAGE_SIZE);
> if (flush == FALSE) {
>
>