Skip to contentSkip to conversation

tools/libxc: arm: Implement save ops arm_setup

RFC PATCH In review Chenxiao Zhao 1 participant 1 message Aug 5, 2016

lore
Share & tools
lore
#0 lore raw

RFC PATCH 3/4 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.

tools/libxc/xc_sr_save_arm.c +17 -1
index 611f99a..a2ef2db 100644
@@ -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
[email protected]
https://lists.xen.org/xen-devel