ia64/xen-unstable

changeset 1346:32618d535cbc

bitkeeper revision 1.892 (40982ce1iEpN7cJYf3gJdBSj_2kRZw)

more live migrate prep
author iap10@labyrinth.cl.cam.ac.uk
date Tue May 04 23:53:05 2004 +0000 (2004-05-04)
parents 2b2dc843edfb
children 7f08b3170e20
files tools/xc/lib/xc_linux_restore.c
line diff
     1.1 --- a/tools/xc/lib/xc_linux_restore.c	Tue May 04 21:57:10 2004 +0000
     1.2 +++ b/tools/xc/lib/xc_linux_restore.c	Tue May 04 23:53:05 2004 +0000
     1.3 @@ -116,8 +116,6 @@ int xc_linux_restore(int xc_handle,
     1.4  
     1.5      if ( (*readerfn)(readerst, name,                  sizeof(name)) ||
     1.6           (*readerfn)(readerst, &nr_pfns,              sizeof(unsigned long)) ||
     1.7 -         (*readerfn)(readerst, &ctxt,                 sizeof(ctxt)) ||
     1.8 -         (*readerfn)(readerst, shared_info,           PAGE_SIZE) ||
     1.9           (*readerfn)(readerst, pfn_to_mfn_frame_list, PAGE_SIZE) )
    1.10      {
    1.11          ERROR("Error when reading from state file");
    1.12 @@ -181,10 +179,7 @@ int xc_linux_restore(int xc_handle,
    1.13      if ( (pm_handle = init_pfn_mapper((domid_t)dom)) < 0 )
    1.14          goto out;
    1.15  
    1.16 -    /* Copy saved contents of shared-info page. No checking needed. */
    1.17 -    ppage = map_pfn_writeable(pm_handle, shared_info_frame);
    1.18 -    memcpy(ppage, shared_info, PAGE_SIZE);
    1.19 -    unmap_pfn(pm_handle, ppage);
    1.20 +
    1.21  
    1.22      /* Build the pfn-to-mfn table. We choose MFN ordering returned by Xen. */
    1.23      if ( get_pfn_list(xc_handle, dom, pfn_to_mfn_table, nr_pfns) != nr_pfns )
    1.24 @@ -403,6 +398,15 @@ int xc_linux_restore(int xc_handle,
    1.25  
    1.26      verbose_printf("\b\b\b\b100%%\nMemory reloaded.\n");
    1.27  
    1.28 +
    1.29 +    if ( (*readerfn)(readerst, &ctxt,                 sizeof(ctxt)) ||
    1.30 +         (*readerfn)(readerst, shared_info,           PAGE_SIZE) )
    1.31 +    {
    1.32 +        ERROR("Error when reading from state file");
    1.33 +        goto out;
    1.34 +    }
    1.35 +
    1.36 +
    1.37      /* Uncanonicalise the suspend-record frame number and poke resume rec. */
    1.38      pfn = ctxt.cpu_ctxt.esi;
    1.39      if ( (pfn >= nr_pfns) || (pfn_type[pfn] != NONE) )
    1.40 @@ -445,9 +449,13 @@ int xc_linux_restore(int xc_handle,
    1.41      }
    1.42      ctxt.pt_base = pfn_to_mfn_table[pfn] << PAGE_SHIFT;
    1.43  
    1.44 -    /* Uncanonicalise the pfn-to-mfn table frame-number list. */
    1.45 +    /* Copy saved contents of shared-info page. No checking needed. */
    1.46 +    ppage = map_pfn_writeable(pm_handle, shared_info_frame);
    1.47 +    memcpy(ppage, shared_info, PAGE_SIZE);
    1.48 +    unmap_pfn(pm_handle, ppage);
    1.49  
    1.50  
    1.51 +    /* Uncanonicalise the pfn-to-mfn table frame-number list. */
    1.52      if ( (mapper_handle1 = mfn_mapper_init(xc_handle, dom,
    1.53  					   1024*1024, PROT_WRITE )) 
    1.54  	 == NULL )