ia64/xen-unstable

changeset 15733:359707941ae8

Do not clobber new wallclock offset on restore.

The new hypervisor will set shared_info->wc_* so do not clobber those
values with the saved versions from the old hypervisor.

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
author Ian Campbell <ian.campbell@xensource.com>
date Wed Aug 08 15:03:40 2007 +0100 (2007-08-08)
parents 00aa18fd722e
children 25e5c1b9faad
files tools/libxc/xc_domain_restore.c
line diff
     1.1 --- a/tools/libxc/xc_domain_restore.c	Wed Aug 08 13:18:07 2007 +0100
     1.2 +++ b/tools/libxc/xc_domain_restore.c	Wed Aug 08 15:03:40 2007 +0100
     1.3 @@ -272,7 +272,8 @@ int xc_domain_restore(int xc_handle, int
     1.4      /* The new domain's shared-info frame number. */
     1.5      unsigned long shared_info_frame;
     1.6      unsigned char shared_info_page[PAGE_SIZE]; /* saved contents from file */
     1.7 -    shared_info_t *shared_info = (shared_info_t *)shared_info_page;
     1.8 +    shared_info_t *old_shared_info = (shared_info_t *)shared_info_page;
     1.9 +    shared_info_t *new_shared_info;
    1.10  
    1.11      /* A copy of the CPU context of the guest. */
    1.12      vcpu_guest_context_t ctxt;
    1.13 @@ -286,9 +287,6 @@ int xc_domain_restore(int xc_handle, int
    1.14      /* Types of the pfns in the current region */
    1.15      unsigned long region_pfn_type[MAX_BATCH_SIZE];
    1.16  
    1.17 -    /* A temporary mapping, and a copy, of one frame of guest memory. */
    1.18 -    unsigned long *page = NULL;
    1.19 -
    1.20      /* A copy of the pfn-to-mfn table frame list. */
    1.21      xen_pfn_t *p2m_frame_list = NULL;
    1.22      
    1.23 @@ -1084,17 +1082,30 @@ int xc_domain_restore(int xc_handle, int
    1.24          goto out;
    1.25      }
    1.26  
    1.27 +    /* Restore contents of shared-info page. No checking needed. */
    1.28 +    new_shared_info = xc_map_foreign_range(
    1.29 +        xc_handle, dom, PAGE_SIZE, PROT_WRITE, shared_info_frame);
    1.30 +
    1.31 +    /* restore saved vcpu_info and arch specific info */
    1.32 +    memcpy(&new_shared_info->vcpu_info,
    1.33 +	   &old_shared_info->vcpu_info,
    1.34 +	   sizeof(new_shared_info->vcpu_info));
    1.35 +    memcpy(&new_shared_info->arch,
    1.36 +	   &old_shared_info->arch,
    1.37 +	   sizeof(new_shared_info->arch));
    1.38 +
    1.39      /* clear any pending events and the selector */
    1.40 -    memset(&(shared_info->evtchn_pending[0]), 0,
    1.41 -           sizeof (shared_info->evtchn_pending));
    1.42 +    memset(&(new_shared_info->evtchn_pending[0]), 0,
    1.43 +           sizeof (new_shared_info->evtchn_pending));
    1.44      for ( i = 0; i < MAX_VIRT_CPUS; i++ )
    1.45 -        shared_info->vcpu_info[i].evtchn_pending_sel = 0;
    1.46 +        new_shared_info->vcpu_info[i].evtchn_pending_sel = 0;
    1.47  
    1.48 -    /* Copy saved contents of shared-info page. No checking needed. */
    1.49 -    page = xc_map_foreign_range(
    1.50 -        xc_handle, dom, PAGE_SIZE, PROT_WRITE, shared_info_frame);
    1.51 -    memcpy(page, shared_info, PAGE_SIZE);
    1.52 -    munmap(page, PAGE_SIZE);
    1.53 +    /* mask event channels */
    1.54 +    memset(&(new_shared_info->evtchn_mask[0]), 0xff,
    1.55 +           sizeof (new_shared_info->evtchn_mask));
    1.56 +
    1.57 +    /* leave wallclock time. set by hypervisor */
    1.58 +    munmap(new_shared_info, PAGE_SIZE);
    1.59  
    1.60      /* Uncanonicalise the pfn-to-mfn table frame-number list. */
    1.61      for ( i = 0; i < P2M_FL_ENTRIES; i++ )