-/* $OpenBSD: pmap.c,v 1.145 2021/06/18 06:17:28 guenther Exp $ */
+/* $OpenBSD: pmap.c,v 1.146 2021/09/05 11:44:46 mpi Exp $ */
/* $NetBSD: pmap.c,v 1.3 2003/05/08 18:13:13 thorpej Exp $ */
/*
kpm = pmap_kernel();
for (i = 0; i < PTP_LEVELS - 1; i++) {
- uvm_obj_init(&kpm->pm_obj[i], NULL, 1);
+ uvm_obj_init(&kpm->pm_obj[i], &pmap_pager, 1);
kpm->pm_ptphint[i] = NULL;
}
memset(&kpm->pm_list, 0, sizeof(kpm->pm_list)); /* pm_list not used */
/* init uvm_object */
for (i = 0; i < PTP_LEVELS - 1; i++) {
- uvm_obj_init(&pmap->pm_obj[i], NULL, 1);
+ uvm_obj_init(&pmap->pm_obj[i], &pmap_pager, 1);
pmap->pm_ptphint[i] = NULL;
}
pmap->pm_stats.wired_count = 0;
-/* $OpenBSD: pmap.c,v 1.175 2021/06/16 09:02:21 mpi Exp $ */
+/* $OpenBSD: pmap.c,v 1.176 2021/09/05 11:44:46 mpi Exp $ */
/*
* Copyright (c) 1998-2004 Michael Shalayeff
*/
kpm = &kernel_pmap_store;
bzero(kpm, sizeof(*kpm));
- uvm_obj_init(&kpm->pm_obj, NULL, 1);
+ uvm_obj_init(&kpm->pm_obj, &pmap_pager, 1);
kpm->pm_space = HPPA_SID_KERNEL;
kpm->pm_pid = HPPA_PID_KERNEL;
kpm->pm_pdir_pg = NULL;
mtx_init(&pmap->pm_mtx, IPL_VM);
- uvm_obj_init(&pmap->pm_obj, NULL, 1);
+ uvm_obj_init(&pmap->pm_obj, &pmap_pager, 1);
for (space = 1 + arc4random_uniform(hppa_sid_max);
pmap_sdir_get(space); space = (space + 1) % hppa_sid_max);
-/* $OpenBSD: pmap.c,v 1.214 2021/06/16 09:02:21 mpi Exp $ */
+/* $OpenBSD: pmap.c,v 1.215 2021/09/05 11:44:46 mpi Exp $ */
/* $NetBSD: pmap.c,v 1.91 2000/06/02 17:46:37 thorpej Exp $ */
/*
kpm = pmap_kernel();
mtx_init(&kpm->pm_mtx, -1); /* must not be used */
mtx_init(&kpm->pm_apte_mtx, IPL_VM);
- uvm_obj_init(&kpm->pm_obj, NULL, 1);
+ uvm_obj_init(&kpm->pm_obj, &pmap_pager, 1);
bzero(&kpm->pm_list, sizeof(kpm->pm_list)); /* pm_list not used */
kpm->pm_pdir = (vaddr_t)(proc0.p_addr->u_pcb.pcb_cr3 + KERNBASE);
kpm->pm_pdirpa = proc0.p_addr->u_pcb.pcb_cr3;
mtx_init(&pmap->pm_apte_mtx, IPL_VM);
/* init uvm_object */
- uvm_obj_init(&pmap->pm_obj, NULL, 1);
+ uvm_obj_init(&pmap->pm_obj, &pmap_pager, 1);
pmap->pm_stats.wired_count = 0;
pmap->pm_stats.resident_count = 1; /* count the PDP allocd below */
pmap->pm_ptphint = NULL;
-/* $OpenBSD: vfs_bio.c,v 1.206 2021/06/16 09:02:21 mpi Exp $ */
+/* $OpenBSD: vfs_bio.c,v 1.207 2021/09/05 11:44:46 mpi Exp $ */
/* $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $ */
/*
struct uvm_object *oldobj = &bp->b_uobj;
int page;
- uvm_obj_init(newobj, NULL, 1);
+ uvm_obj_init(newobj, &bufcache_pager, 1);
for (page = 0; page < atop(xbpp[i]->b_bufsize); page++) {
struct vm_page *pg = uvm_pagelookup(oldobj,
xbpp[i]->b_poffs + ptoa(page));
-/* $OpenBSD: vfs_biomem.c,v 1.49 2021/06/16 09:02:21 mpi Exp $ */
+/* $OpenBSD: vfs_biomem.c,v 1.50 2021/09/05 11:44:46 mpi Exp $ */
/*
* Copyright (c) 2007 Artur Grabowski <art@openbsd.org>
KASSERT(bp->b_data == NULL);
splassert(IPL_BIO);
- uvm_obj_init(&bp->b_uobj, NULL, 1);
+ uvm_obj_init(&bp->b_uobj, &bufcache_pager, 1);
/*
* Attempt to allocate with NOWAIT. if we can't, then throw
-/* $OpenBSD: uvm_object.c,v 1.19 2021/06/16 09:02:21 mpi Exp $ */
+/* $OpenBSD: uvm_object.c,v 1.20 2021/09/05 11:44:46 mpi Exp $ */
/*
* Copyright (c) 2006 The NetBSD Foundation, Inc.
#include <uvm/uvm.h>
+/* Dummy object used by some pmaps for sanity checks. */
+const struct uvm_pagerops pmap_pager = {
+ /* nothing */
+};
+
+/* Dummy object used by the buffer cache for sanity checks. */
+const struct uvm_pagerops bufcache_pager = {
+ /* nothing */
+};
+
/* We will fetch this page count per step */
#define FETCH_PAGECOUNT 16
struct vm_page *pg;
struct pglist pgl;
+ KASSERT(UVM_OBJ_IS_BUFCACHE(uobj));
+ KERNEL_ASSERT_LOCKED();
+
TAILQ_INIT(&pgl);
/*
* Extract from rb tree in offset order. The phys addresses
-/* $OpenBSD: uvm_object.h,v 1.26 2021/06/16 09:02:21 mpi Exp $ */
+/* $OpenBSD: uvm_object.h,v 1.27 2021/09/05 11:44:46 mpi Exp $ */
/* $NetBSD: uvm_object.h,v 1.11 2001/03/09 01:02:12 chs Exp $ */
/*
extern const struct uvm_pagerops uvm_vnodeops;
extern const struct uvm_pagerops uvm_deviceops;
+extern const struct uvm_pagerops pmap_pager;
+extern const struct uvm_pagerops bufcache_pager;
/* For object trees */
int uvm_pagecmp(const struct vm_page *, const struct vm_page *);
#define UVM_OBJ_IS_AOBJ(uobj) \
((uobj)->pgops == &aobj_pager)
+#define UVM_OBJ_IS_PMAP(uobj) \
+ ((uobj)->pgops == &pmap_pager)
+
+#define UVM_OBJ_IS_BUFCACHE(uobj) \
+ ((uobj)->pgops == &bufcache_pager)
+
void uvm_obj_init(struct uvm_object *, const struct uvm_pagerops *, int);
int uvm_obj_wire(struct uvm_object *, voff_t, voff_t, struct pglist *);
void uvm_obj_unwire(struct uvm_object *, voff_t, voff_t);
-/* $OpenBSD: uvm_page.c,v 1.157 2021/04/21 10:02:05 mpi Exp $ */
+/* $OpenBSD: uvm_page.c,v 1.158 2021/09/05 11:44:46 mpi Exp $ */
/* $NetBSD: uvm_page.c,v 1.44 2000/11/27 08:40:04 chs Exp $ */
/*
struct vm_page *pg;
int i, r;
+ KASSERT(UVM_OBJ_IS_BUFCACHE(obj));
+ KERNEL_ASSERT_LOCKED();
TAILQ_INIT(&plist);
r = uvm_pglistalloc(size, dma_constraint.ucr_low,
int i, r;
voff_t offset;
+ KASSERT(UVM_OBJ_IS_BUFCACHE(obj));
+ KERNEL_ASSERT_LOCKED();
TAILQ_INIT(&plist);
if (size == 0)