diff options
Diffstat (limited to 'tools/libxc/xc_hvm_restore.c')
-rw-r--r-- | tools/libxc/xc_hvm_restore.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/tools/libxc/xc_hvm_restore.c b/tools/libxc/xc_hvm_restore.c index 7092d5cea8..b2b9999fea 100644 --- a/tools/libxc/xc_hvm_restore.c +++ b/tools/libxc/xc_hvm_restore.c @@ -98,6 +98,8 @@ int xc_hvm_restore(int xc_handle, int io_fd, /* Types of the pfns in the current region */ unsigned long region_pfn_type[MAX_BATCH_SIZE]; + struct xen_add_to_physmap xatp; + /* hvm guest mem size (Mb) */ memsize = (unsigned long long)*store_mfn; v_end = memsize << 20; @@ -134,15 +136,6 @@ int xc_hvm_restore(int xc_handle, int io_fd, goto out; } - /* Get the domain's shared-info frame. */ - domctl.cmd = XEN_DOMCTL_getdomaininfo; - domctl.domain = (domid_t)dom; - if (xc_domctl(xc_handle, &domctl) < 0) { - ERROR("Could not get information on new domain"); - goto out; - } - shared_info_frame = domctl.u.getdomaininfo.shared_info_frame; - if(xc_domain_setmaxmem(xc_handle, dom, PFN_TO_KB(max_pfn)) != 0) { errno = ENOMEM; goto out; @@ -346,6 +339,21 @@ int xc_hvm_restore(int xc_handle, int io_fd, } } + /* Shared-info pfn */ + if (!read_exact(io_fd, &(shared_info_frame), sizeof(uint32_t)) ) { + ERROR("reading the shared-info pfn failed!\n"); + goto out; + } + /* Map the shared-info frame where it was before */ + xatp.domid = dom; + xatp.space = XENMAPSPACE_shared_info; + xatp.idx = 0; + xatp.gpfn = shared_info_frame; + if ( (rc = xc_memory_op(xc_handle, XENMEM_add_to_physmap, &xatp)) != 0 ) { + ERROR("setting the shared-info pfn failed!\n"); + goto out; + } + rc = 0; goto out; |