aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/memory.c
diff options
context:
space:
mode:
authorTim Deegan <tim@xen.org>2012-05-17 10:24:54 +0100
committerTim Deegan <tim@xen.org>2012-05-17 10:24:54 +0100
commit06e7bfed2061b590711a99eb3713fb52aee25152 (patch)
tree49e8fcf61590475d0326c5e8a22935fc0eabd1bd /xen/common/memory.c
parentd5132620b5f002e8dfe0afc798a24988cfabdea3 (diff)
downloadxen-06e7bfed2061b590711a99eb3713fb52aee25152.tar.gz
xen-06e7bfed2061b590711a99eb3713fb52aee25152.tar.bz2
xen-06e7bfed2061b590711a99eb3713fb52aee25152.zip
common: Use get_page_from_gfn() instead of get_gfn()/put_gfn.
Signed-off-by: Tim Deegan <tim@xen.org> Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Diffstat (limited to 'xen/common/memory.c')
-rw-r--r--xen/common/memory.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/xen/common/memory.c b/xen/common/memory.c
index f0d396109b..5d64cb6db5 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -676,7 +676,7 @@ long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE(void) arg)
case XENMEM_remove_from_physmap:
{
struct xen_remove_from_physmap xrfp;
- unsigned long mfn;
+ struct page_info *page;
struct domain *d;
if ( copy_from_guest(&xrfp, arg, 1) )
@@ -694,15 +694,15 @@ long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE(void) arg)
domain_lock(d);
- mfn = get_gfn_untyped(d, xrfp.gpfn);
-
- if ( mfn_valid(mfn) )
- guest_physmap_remove_page(d, xrfp.gpfn, mfn, 0);
+ page = get_page_from_gfn(d, xrfp.gpfn, NULL, P2M_ALLOC);
+ if ( page )
+ {
+ guest_physmap_remove_page(d, xrfp.gpfn, page_to_mfn(page), 0);
+ put_page(page);
+ }
else
rc = -ENOENT;
- put_gfn(d, xrfp.gpfn);
-
domain_unlock(d);
rcu_unlock_domain(d);