diff options
Diffstat (limited to 'tools/libxc/xc_linux_restore.c')
-rw-r--r-- | tools/libxc/xc_linux_restore.c | 42 |
1 files changed, 10 insertions, 32 deletions
diff --git a/tools/libxc/xc_linux_restore.c b/tools/libxc/xc_linux_restore.c index 1db39317de..8909878f81 100644 --- a/tools/libxc/xc_linux_restore.c +++ b/tools/libxc/xc_linux_restore.c @@ -19,31 +19,6 @@ #define DPRINTF(_f, _a...) ((void)0) #endif -static int get_pfn_list(int xc_handle, - u32 domain_id, - unsigned long *pfn_buf, - unsigned long max_pfns) -{ - dom0_op_t op; - int ret; - op.cmd = DOM0_GETMEMLIST; - op.u.getmemlist.domain = (domid_t)domain_id; - op.u.getmemlist.max_pfns = max_pfns; - op.u.getmemlist.buffer = pfn_buf; - - if ( mlock(pfn_buf, max_pfns * sizeof(unsigned long)) != 0 ) - { - PERROR("Could not lock pfn list buffer"); - return -1; - } - - ret = do_dom0_op(xc_handle, &op); - - (void)munlock(pfn_buf, max_pfns * sizeof(unsigned long)); - - return (ret < 0) ? -1 : op.u.getmemlist.num_pfns; -} - /** Read the vmconfig string from the state input. * It is stored as a 4-byte count 'n' followed by n bytes. * The config data is stored in a new string in 'ioctxt->vmconfig', @@ -94,7 +69,8 @@ int xc_linux_restore(int xc_handle, XcIOContext *ioctxt) /* The new domain's shared-info frame number. */ unsigned long shared_info_frame; - unsigned char shared_info[PAGE_SIZE]; /* saved contents from file */ + unsigned char shared_info_page[PAGE_SIZE]; /* saved contents from file */ + shared_info_t *shared_info = (shared_info_t *)shared_info_page; /* A copy of the CPU context of the guest. */ full_execution_context_t ctxt; @@ -201,6 +177,7 @@ int xc_linux_restore(int xc_handle, XcIOContext *ioctxt) /* Get the domain's shared-info frame. */ op.cmd = DOM0_GETDOMAININFO; op.u.getdomaininfo.domain = (domid_t)dom; + op.u.getdomaininfo.exec_domain = 0; op.u.getdomaininfo.ctxt = NULL; if ( do_dom0_op(xc_handle, &op) < 0 ) { @@ -219,7 +196,7 @@ int xc_linux_restore(int xc_handle, XcIOContext *ioctxt) } /* Build the pfn-to-mfn table. We choose MFN ordering returned by Xen. */ - if ( get_pfn_list(xc_handle, dom, pfn_to_mfn_table, nr_pfns) != nr_pfns ) + if ( xc_get_pfn_list(xc_handle, dom, pfn_to_mfn_table, nr_pfns) != nr_pfns ) { xcio_error(ioctxt, "Did not read correct number of frame " "numbers for new dom"); @@ -525,8 +502,8 @@ int xc_linux_restore(int xc_handle, XcIOContext *ioctxt) } } - if ( xcio_read(ioctxt, &ctxt, sizeof(ctxt)) || - xcio_read(ioctxt, shared_info, PAGE_SIZE) ) + if ( xcio_read(ioctxt, &ctxt, sizeof(ctxt)) || + xcio_read(ioctxt, shared_info_page, PAGE_SIZE) ) { xcio_error(ioctxt, "Error when reading from state file"); goto out; @@ -577,9 +554,10 @@ int xc_linux_restore(int xc_handle, XcIOContext *ioctxt) ctxt.pt_base = pfn_to_mfn_table[pfn] << PAGE_SHIFT; /* clear any pending events and the selector */ - memset(&(((shared_info_t *)shared_info)->evtchn_pending[0]), - 0, sizeof (((shared_info_t *)shared_info)->evtchn_pending)+ - sizeof(((shared_info_t *)shared_info)->evtchn_pending_sel)); + memset(&(shared_info->evtchn_pending[0]), 0, + sizeof (shared_info->evtchn_pending)); + for ( i = 0; i < MAX_VIRT_CPUS; i++ ) + shared_info->vcpu_data[i].evtchn_pending_sel = 0; /* Copy saved contents of shared-info page. No checking needed. */ ppage = xc_map_foreign_range( |