[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH RFC XEN v1 04/14] xen: arm: Implement XEN_DOMCTL_getpageframeinfo3.



This is used by the save/restore code.

On ARM we only have RAM (0) or not-RAM (XTAB) types.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 xen/arch/arm/domctl.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c
index d42b2bf..d3459ee 100644
--- a/xen/arch/arm/domctl.c
+++ b/xen/arch/arm/domctl.c
@@ -133,6 +133,55 @@ long arch_do_domctl(struct xen_domctl *domctl, struct 
domain *d,
         rc = 0;
         break;
     }
+
+   case XEN_DOMCTL_getpageframeinfo3:
+    {
+        unsigned int i;
+        unsigned int num = domctl->u.getpageframeinfo3.num;
+        XEN_GUEST_HANDLE_64(xen_pfn_t) array = 
domctl->u.getpageframeinfo3.array;
+
+        if ( unlikely(num > 1024) ||
+             unlikely(num != domctl->u.getpageframeinfo3.num) )
+        {
+            rc = -E2BIG;
+            break;
+        }
+
+        for ( i = 0; i < num; ++i )
+        {
+            xen_pfn_t gfn = 0, type = 0;
+            struct page_info *page;
+            p2m_type_t t;
+
+            if ( copy_from_guest_offset(&gfn, array, i, 1) )
+            {
+                rc = -EFAULT;
+                break;
+            }
+
+            page = get_page_from_gfn(d, gfn, &t, P2M_ALLOC);
+
+            if ( unlikely(!page) ||
+                 unlikely(is_xen_heap_page(page)) )
+                type = XEN_DOMCTL_PFINFO_XTAB;
+            else
+                type = 0; /* Just regular RAM */
+
+            if ( page )
+                put_page(page);
+
+            if ( copy_to_guest_offset(array, i, &type, 1) )
+            {
+                rc = -EFAULT;
+                break;
+            }
+        }
+
+        rc = 0;
+
+        break;
+    }
+
     default:
         rc = subarch_do_domctl(domctl, d, u_domctl);
 
-- 
2.6.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.