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

[Xen-devel] [PATCH RFC 03/04] tools/libxc: arm: Implement save ops arm_setup



arm_setup need to return number of pages that vm is allocated. Code is copied from x64 save ops.

Signed-off-by: Chenxiao Zhao <chenxiao.zhao@xxxxxxxxx>

diff --git a/tools/libxc/xc_sr_save_arm.c b/tools/libxc/xc_sr_save_arm.c
index 611f99a..a2ef2db 100644
--- a/tools/libxc/xc_sr_save_arm.c
+++ b/tools/libxc/xc_sr_save_arm.c
@@ -122,7 +122,23 @@ static int arm_normalise_page(struct xc_sr_context *ctx,

 static int arm_setup(struct xc_sr_context *ctx)
 {
-    /* no-op */
+    xc_interface *xch = ctx->xch;
+    xen_pfn_t nr_pfns;
+
+    if (xc_domain_nr_gpfns(xch, ctx->domid, &nr_pfns) < 0 )
+    {
+        PERROR("Unable to obtain the guest p2m size");
+        return -1;
+    }
+    if ( nr_pfns > ~XEN_DOMCTL_PFINFO_LTAB_MASK )
+    {
+        errno = E2BIG;
+        PERROR("Cannot save this big a guest");
+        return -1;
+    }
+
+    ctx->save.p2m_size = nr_pfns;
+
     return 0;
 }

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

 


Rackspace

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