* [PATCH RFC 03/04] tools/libxc: arm: Implement save ops arm_setup
@ 2016-08-05 2:54 Chenxiao Zhao
0 siblings, 0 replies; only message in thread
From: Chenxiao Zhao @ 2016-08-05 2:54 UTC (permalink / raw)
To: xen-devel@lists.xen.org; +Cc: Julien Grall
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@gmail.com>
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@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-08-05 2:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-05 2:54 [PATCH RFC 03/04] tools/libxc: arm: Implement save ops arm_setup Chenxiao Zhao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).