View | Details | Raw Unified | Return to bug 233088 | Differences between
and this patch

Collapse All | Expand All

(-)b/sys/arm64/arm64/pmap.c (-11 / +42 lines)
Lines 532-538 CTASSERT(L1_BLOCK == L2_BLOCK); Link Here
532
532
533
/*
533
/*
534
 * Checks if the page is dirty. We currently lack proper tracking of this on
534
 * Checks if the page is dirty. We currently lack proper tracking of this on
535
 * arm64 so for now assume is a page mapped as rw was accessed it is.
535
 * arm64 so for now assume if a page mapped as rw was accessed it is dirty.
536
 */
536
 */
537
static inline int
537
static inline int
538
pmap_page_dirty(pt_entry_t pte)
538
pmap_page_dirty(pt_entry_t pte)
Lines 2382-2387 pmap_pv_insert_l2(pmap_t pmap, vm_offset_t va, pd_entry_t l2e, u_int flags, Link Here
2382
	return (true);
2382
	return (true);
2383
}
2383
}
2384
2384
2385
static void
2386
pmap_remove_kernel_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_t va)
2387
{
2388
	pt_entry_t newl2;
2389
	vm_page_t ml3;
2390
	vm_paddr_t ml3pa;
2391
2392
	KASSERT(!VIRT_IN_DMAP(va), ("removing direct mapping of %#lx", va));
2393
	KASSERT(pmap == kernel_pmap, ("pmap %p is not kernel_pmap", pmap));
2394
	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
2395
2396
	ml3 = pmap_remove_pt_page(pmap, va);
2397
	if (ml3 == NULL)
2398
		panic("pmap_remove_kernel_l2: Missing pt page");
2399
2400
	ml3pa = VM_PAGE_TO_PHYS(ml3);
2401
	newl2 = ml3pa | ATTR_DEFAULT | ATTR_IDX(ml3->md.pv_memattr) | L2_TABLE;
2402
2403
	/*
2404
	 * Initialize the page table page.
2405
	 */
2406
	pagezero((void *)PHYS_TO_DMAP(ml3pa));
2407
2408
	/*
2409
	 * Demote the mapping.
2410
	 */
2411
	(void)pmap_load_store(l2, newl2);
2412
}
2413
2385
/*
2414
/*
2386
 * pmap_remove_l2: do the things to unmap a level 2 superpage in a process
2415
 * pmap_remove_l2: do the things to unmap a level 2 superpage in a process
2387
 */
2416
 */
Lines 2419-2434 pmap_remove_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_t sva, Link Here
2419
				vm_page_aflag_clear(m, PGA_WRITEABLE);
2448
				vm_page_aflag_clear(m, PGA_WRITEABLE);
2420
		}
2449
		}
2421
	}
2450
	}
2422
	KASSERT(pmap != kernel_pmap,
2451
	if (pmap == kernel_pmap) {
2423
	    ("Attempting to remove an l2 kernel page"));
2452
		pmap_remove_kernel_l2(pmap, l2, sva);
2424
	ml3 = pmap_remove_pt_page(pmap, sva);
2453
	} else {
2425
	if (ml3 != NULL) {
2454
		ml3 = pmap_remove_pt_page(pmap, sva);
2426
		pmap_resident_count_dec(pmap, 1);
2455
		if (ml3 != NULL) {
2427
		KASSERT(ml3->wire_count == NL3PG,
2456
			pmap_resident_count_dec(pmap, 1);
2428
		    ("pmap_remove_l2: l3 page wire count error"));
2457
			KASSERT(ml3->wire_count == NL3PG,
2429
		ml3->wire_count = 1;
2458
			    ("pmap_remove_l2: l3 page wire count error"));
2430
		vm_page_unwire_noq(ml3);
2459
			ml3->wire_count = 1;
2431
		pmap_add_delayed_free_list(ml3, free, FALSE);
2460
			vm_page_unwire_noq(ml3);
2461
			pmap_add_delayed_free_list(ml3, free, FALSE);
2462
		}
2432
	}
2463
	}
2433
	return (pmap_unuse_pt(pmap, sva, l1e, free));
2464
	return (pmap_unuse_pt(pmap, sva, l1e, free));
2434
}
2465
}

Return to bug 233088