-/* $OpenBSD: pmap.h,v 1.17 2021/05/30 15:08:08 visa Exp $ */
+/* $OpenBSD: pmap.h,v 1.18 2021/10/12 18:06:15 kettenis Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
#define pmap_kernel() (&kernel_pmap_store)
#define pmap_resident_count(pm) ((pm)->pm_stats.resident_count)
+#define pmap_wired_count(pm) ((pm)->pm_stats.wired_count)
#define pmap_unuse_final(p)
#define pmap_remove_holes(vm)
-/* $OpenBSD: pmap.c,v 1.56 2021/05/11 18:21:12 kettenis Exp $ */
+/* $OpenBSD: pmap.c,v 1.57 2021/10/12 18:06:15 kettenis Exp $ */
/*
* Copyright (c) 2015 Martin Pieuchot
return !!(pted->pted_va & PTED_VA_MANAGED_M);
}
+static inline int
+PTED_WIRED(struct pte_desc *pted)
+{
+ return !!(pted->pted_va & PTED_VA_WIRED_M);
+}
+
static inline int
PTED_VALID(struct pte_desc *pted)
{
pm->pm_stats.resident_count--;
+ if (PTED_WIRED(pted)) {
+ pm->pm_stats.wired_count--;
+ pted->pted_va &= ~PTED_VA_WIRED_M;
+ }
+
PMAP_HASH_LOCK(s);
if ((pte = pmap_ptedinhash(pted)) != NULL)
pte_zap(pte, pted);
prot &= ~PROT_WRITE;
pmap_fill_pte(pm, va, pa, pted, prot, cache);
+ if (flags & PMAP_WIRED) {
+ pted->pted_va |= PTED_VA_WIRED_M;
+ pm->pm_stats.wired_count++;
+ }
if (pg != NULL) {
pmap_enter_pv(pted, pg); /* only managed mem */
void
pmap_unwire(pmap_t pm, vaddr_t va)
{
+ struct pte_desc *pted;
+
+ PMAP_VP_LOCK(pm);
+ pted = pmap_vp_lookup(pm, va);
+ if (pted && PTED_WIRED(pted)) {
+ pm->pm_stats.wired_count--;
+ pted->pted_va &= ~PTED_VA_WIRED_M;
+ }
+ PMAP_VP_UNLOCK(pm);
}
void