From c5ddad9464398d4ade3321a300801dc031b0f224 Mon Sep 17 00:00:00 2001 From: Owain Ainsworth Date: Fri, 15 Apr 2011 21:47:25 +0000 Subject: 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) --- sys/uvm/uvm_glue.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'sys/uvm/uvm_glue.c') 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); +} -- cgit v1.2.3