summaryrefslogtreecommitdiff
path: root/sys/uvm/uvm_glue.c
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2011-04-15 21:47:25 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2011-04-15 21:47:25 +0000
commitc5ddad9464398d4ade3321a300801dc031b0f224 (patch)
tree1746a60169c2b5f65815b439558d7c5be3bd53e0 /sys/uvm/uvm_glue.c
parent59923c29825f41832e3d6363d04c0e3f0c1b416d (diff)
move uvm_pageratop from uvm_pager.c local to a general uvm function
(uvm_atopg) and use it in uvm_km_doputpage to replace some handrolled code. Shrinks the kernel a trivial amount. ok beck@ and miod@ (who suggested i name it uvm_atopg not uvm_atop)
Diffstat (limited to 'sys/uvm/uvm_glue.c')
-rw-r--r--sys/uvm/uvm_glue.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/sys/uvm/uvm_glue.c b/sys/uvm/uvm_glue.c
index 7c67202db33..aa55afbd07d 100644
--- a/sys/uvm/uvm_glue.c
+++ b/sys/uvm/uvm_glue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_glue.c,v 1.57 2011/04/07 13:20:25 miod Exp $ */
+/* $OpenBSD: uvm_glue.c,v 1.58 2011/04/15 21:47:24 oga Exp $ */
/* $NetBSD: uvm_glue.c,v 1.44 2001/02/06 19:54:44 eeh Exp $ */
/*
@@ -475,3 +475,20 @@ uvm_swapout_threads(void)
pmap_collect(p->p_vmspace->vm_map.pmap);
}
}
+
+/*
+ * uvm_atopg: convert KVAs back to their page structures.
+ */
+struct vm_page *
+uvm_atopg(vaddr_t kva)
+{
+ struct vm_page *pg;
+ paddr_t pa;
+ boolean_t rv;
+
+ rv = pmap_extract(pmap_kernel(), kva, &pa);
+ KASSERT(rv);
+ pg = PHYS_TO_VM_PAGE(pa);
+ KASSERT(pg != NULL);
+ return (pg);
+}