ia64/xen-unstable

changeset 14837:fdbbc6aa2cbf

Merge with xen-ia64-unstable.hg
author kfraser@localhost.localdomain
date Fri Apr 13 11:11:41 2007 +0100 (2007-04-13)
parents 41471cc650a2 e3b3800c769a
children f92a79e39da8
files
line diff
     1.1 --- a/README	Thu Apr 12 10:30:12 2007 -0600
     1.2 +++ b/README	Fri Apr 13 11:11:41 2007 +0100
     1.3 @@ -199,3 +199,7 @@ Xend (the Xen daemon) has the following 
     1.4      * For optional PAM support, PyPAM:
     1.5            URL:    http://www.pangalactic.org/PyPAM/
     1.6            Debian: python-pam
     1.7 +
     1.8 +    * For optional XenAPI support in XM, PyXML:
     1.9 +          URL:    http://pyxml.sourceforge.net
    1.10 +          YUM:    PyXML
     2.1 --- a/tools/libxc/xc_domain_restore.c	Thu Apr 12 10:30:12 2007 -0600
     2.2 +++ b/tools/libxc/xc_domain_restore.c	Fri Apr 13 11:11:41 2007 +0100
     2.3 @@ -688,33 +688,22 @@ int xc_domain_restore(int xc_handle, int
     2.4              ERROR("error zeroing magic pages");
     2.5              goto out;
     2.6          }
     2.7 -        
     2.8 -        xc_set_hvm_param(xc_handle, dom, HVM_PARAM_IOREQ_PFN, magic_pfns[0]);
     2.9 -        xc_set_hvm_param(xc_handle, dom, HVM_PARAM_BUFIOREQ_PFN, magic_pfns[1]);
    2.10 -        xc_set_hvm_param(xc_handle, dom, HVM_PARAM_STORE_PFN, magic_pfns[2]);
    2.11 -        xc_set_hvm_param(xc_handle, dom, HVM_PARAM_PAE_ENABLED, pae);
    2.12 -        xc_set_hvm_param(xc_handle, dom, HVM_PARAM_STORE_EVTCHN, store_evtchn);
    2.13 -        *store_mfn = magic_pfns[2];
    2.14 -
    2.15 -        /* Read vcpu contexts */
    2.16 -        for ( i = 0; i <= max_vcpu_id; i++ )
    2.17 +                
    2.18 +        if ( (rc = xc_set_hvm_param(xc_handle, dom, 
    2.19 +                                    HVM_PARAM_IOREQ_PFN, magic_pfns[0]))
    2.20 +             || (rc = xc_set_hvm_param(xc_handle, dom, 
    2.21 +                                       HVM_PARAM_BUFIOREQ_PFN, magic_pfns[1]))
    2.22 +             || (rc = xc_set_hvm_param(xc_handle, dom, 
    2.23 +                                       HVM_PARAM_STORE_PFN, magic_pfns[2]))
    2.24 +             || (rc = xc_set_hvm_param(xc_handle, dom, 
    2.25 +                                       HVM_PARAM_PAE_ENABLED, pae))
    2.26 +             || (rc = xc_set_hvm_param(xc_handle, dom, 
    2.27 +                                       HVM_PARAM_STORE_EVTCHN, store_evtchn)) )
    2.28          {
    2.29 -            if ( !(vcpumap & (1ULL << i)) )
    2.30 -                continue;
    2.31 -
    2.32 -            if ( !read_exact(io_fd, &(ctxt), sizeof(ctxt)) )
    2.33 -            {
    2.34 -                ERROR("error read vcpu context.\n");
    2.35 -                goto out;
    2.36 -            }
    2.37 -            
    2.38 -            if ( (rc = xc_vcpu_setcontext(xc_handle, dom, i, &ctxt)) )
    2.39 -            {
    2.40 -                ERROR("Could not set vcpu context, rc=%d", rc);
    2.41 -                goto out;
    2.42 -            }
    2.43 -            rc = 1;
    2.44 +            ERROR("error setting HVM params: %i", rc);
    2.45 +            goto out;
    2.46          }
    2.47 +        *store_mfn = magic_pfns[2];
    2.48  
    2.49          /* Read HVM context */
    2.50          if ( !read_exact(io_fd, &rec_len, sizeof(uint32_t)) )
     3.1 --- a/tools/libxc/xc_domain_save.c	Thu Apr 12 10:30:12 2007 -0600
     3.2 +++ b/tools/libxc/xc_domain_save.c	Fri Apr 13 11:11:41 2007 +0100
     3.3 @@ -378,8 +378,7 @@ static int analysis_phase(int xc_handle,
     3.4  
     3.5  
     3.6  static int suspend_and_state(int (*suspend)(int), int xc_handle, int io_fd,
     3.7 -                             int dom, xc_dominfo_t *info,
     3.8 -                             vcpu_guest_context_t *ctxt)
     3.9 +                             int dom, xc_dominfo_t *info)
    3.10  {
    3.11      int i = 0;
    3.12  
    3.13 @@ -397,10 +396,6 @@ static int suspend_and_state(int (*suspe
    3.14          return -1;
    3.15      }
    3.16  
    3.17 -    if ( xc_vcpu_getcontext(xc_handle, dom, 0, ctxt) )
    3.18 -        ERROR("Could not get vcpu context");
    3.19 -
    3.20 -
    3.21      if ( info->dying )
    3.22      {
    3.23          ERROR("domain is dying");
    3.24 @@ -663,10 +658,11 @@ static xen_pfn_t *xc_map_m2p(int xc_hand
    3.25  static xen_pfn_t *map_and_save_p2m_table(int xc_handle, 
    3.26                                           int io_fd, 
    3.27                                           uint32_t dom,
    3.28 -                                         vcpu_guest_context_t *ctxt,
    3.29                                           unsigned long p2m_size,
    3.30                                           shared_info_t *live_shinfo)
    3.31  {
    3.32 +    vcpu_guest_context_t ctxt;
    3.33 +
    3.34      /* Double and single indirect references to the live P2M table */
    3.35      xen_pfn_t *live_p2m_frame_list_list = NULL;
    3.36      xen_pfn_t *live_p2m_frame_list = NULL;
    3.37 @@ -730,13 +726,19 @@ static xen_pfn_t *map_and_save_p2m_table
    3.38          }
    3.39      }
    3.40  
    3.41 +    if ( xc_vcpu_getcontext(xc_handle, dom, 0, &ctxt) )
    3.42 +    {
    3.43 +        ERROR("Could not get vcpu context");
    3.44 +        goto out;
    3.45 +    }
    3.46 +
    3.47      /*
    3.48       * Write an extended-info structure to inform the restore code that
    3.49       * a PAE guest understands extended CR3 (PDPTs above 4GB). Turns off
    3.50       * slow paths in the restore code.
    3.51       */
    3.52      if ( (pt_levels == 3) &&
    3.53 -         (ctxt->vm_assist & (1UL << VMASST_TYPE_pae_extended_cr3)) )
    3.54 +         (ctxt.vm_assist & (1UL << VMASST_TYPE_pae_extended_cr3)) )
    3.55      {
    3.56          unsigned long signature = ~0UL;
    3.57          uint32_t tot_sz   = sizeof(struct vcpu_guest_context) + 8;
    3.58 @@ -746,7 +748,7 @@ static xen_pfn_t *map_and_save_p2m_table
    3.59               !write_exact(io_fd, &tot_sz,    sizeof(tot_sz)) ||
    3.60               !write_exact(io_fd, &chunk_sig, 4) ||
    3.61               !write_exact(io_fd, &chunk_sz,  sizeof(chunk_sz)) ||
    3.62 -             !write_exact(io_fd, ctxt,       sizeof(*ctxt)) )
    3.63 +             !write_exact(io_fd, &ctxt,      sizeof(ctxt)) )
    3.64          {
    3.65              ERROR("write: extended info");
    3.66              goto out;
    3.67 @@ -853,11 +855,6 @@ int xc_domain_save(int xc_handle, int io
    3.68          return 1;
    3.69      }
    3.70  
    3.71 -    if ( xc_vcpu_getcontext(xc_handle, dom, 0, &ctxt) )
    3.72 -    {
    3.73 -        ERROR("Could not get vcpu context");
    3.74 -        goto out;
    3.75 -    }
    3.76      shared_info_frame = info.shared_info_frame;
    3.77  
    3.78      /* Map the shared info frame */
    3.79 @@ -900,7 +897,7 @@ int xc_domain_save(int xc_handle, int io
    3.80      else
    3.81      {
    3.82          /* This is a non-live suspend. Suspend the domain .*/
    3.83 -        if ( suspend_and_state(suspend, xc_handle, io_fd, dom, &info, &ctxt) )
    3.84 +        if ( suspend_and_state(suspend, xc_handle, io_fd, dom, &info) )
    3.85          {
    3.86              ERROR("Domain appears not to have suspended");
    3.87              goto out;
    3.88 @@ -999,7 +996,7 @@ int xc_domain_save(int xc_handle, int io
    3.89  
    3.90          /* Map the P2M table, and write the list of P2M frames */
    3.91          live_p2m = map_and_save_p2m_table(xc_handle, io_fd, dom, 
    3.92 -                                          &ctxt, p2m_size, live_shinfo);
    3.93 +                                          p2m_size, live_shinfo);
    3.94          if ( live_p2m == NULL )
    3.95          {
    3.96              ERROR("Failed to map/save the p2m frame list");
    3.97 @@ -1304,17 +1301,13 @@ int xc_domain_save(int xc_handle, int io
    3.98                  DPRINTF("Start last iteration\n");
    3.99                  last_iter = 1;
   3.100  
   3.101 -                if ( suspend_and_state(suspend, xc_handle, io_fd, dom, &info,
   3.102 -                                       &ctxt) )
   3.103 +                if ( suspend_and_state(suspend, xc_handle, io_fd, dom, &info) )
   3.104                  {
   3.105                      ERROR("Domain appears not to have suspended");
   3.106                      goto out;
   3.107                  }
   3.108  
   3.109 -                DPRINTF("SUSPEND shinfo %08lx eip %08lx edx %08lx\n",
   3.110 -                        info.shared_info_frame,
   3.111 -                        (unsigned long)ctxt.user_regs.eip,
   3.112 -                        (unsigned long)ctxt.user_regs.edx);
   3.113 +                DPRINTF("SUSPEND shinfo %08lx\n", info.shared_info_frame);
   3.114              }
   3.115  
   3.116              if ( xc_shadow_control(xc_handle, dom, 
   3.117 @@ -1410,27 +1403,6 @@ int xc_domain_save(int xc_handle, int io
   3.118              goto out;
   3.119          }
   3.120  
   3.121 -        /* Save vcpu contexts */
   3.122 -
   3.123 -        for ( i = 0; i <= info.max_vcpu_id; i++ )
   3.124 -        {
   3.125 -            if ( !(vcpumap & (1ULL << i)) )
   3.126 -                continue;
   3.127 -            
   3.128 -            if ( xc_vcpu_getcontext(xc_handle, dom, i, &ctxt) )
   3.129 -            {
   3.130 -                ERROR("HVM:Could not get vcpu context");
   3.131 -                goto out;
   3.132 -            }
   3.133 -            
   3.134 -            DPRINTF("write vcpu %d context.\n", i); 
   3.135 -            if ( !write_exact(io_fd, &(ctxt), sizeof(ctxt)) )
   3.136 -            {
   3.137 -                ERROR("write vcpu context failed!\n");
   3.138 -                goto out;
   3.139 -            }
   3.140 -        }
   3.141 -
   3.142          /* Get HVM context from Xen and save it too */
   3.143          if ( (rec_size = xc_domain_hvm_getcontext(xc_handle, dom, hvm_buf, 
   3.144                                                    hvm_buf_size)) == -1 )
   3.145 @@ -1494,6 +1466,12 @@ int xc_domain_save(int xc_handle, int io
   3.146          }
   3.147      }
   3.148  
   3.149 +    if ( xc_vcpu_getcontext(xc_handle, dom, 0, &ctxt) )
   3.150 +    {
   3.151 +        ERROR("Could not get vcpu context");
   3.152 +        goto out;
   3.153 +    }
   3.154 +
   3.155      /* Canonicalise the suspend-record frame number. */
   3.156      if ( !translate_mfn_to_pfn(&ctxt.user_regs.edx) )
   3.157      {
     4.1 --- a/tools/libxc/xg_private.c	Thu Apr 12 10:30:12 2007 -0600
     4.2 +++ b/tools/libxc/xg_private.c	Fri Apr 13 11:11:41 2007 +0100
     4.3 @@ -198,18 +198,6 @@ unsigned long csum_page(void *page)
     4.4      return -1;
     4.5  }
     4.6  
     4.7 -__attribute__((weak)) int xc_get_hvm_param(
     4.8 -    int handle, domid_t dom, int param, unsigned long *value)
     4.9 -{
    4.10 -    return -ENOSYS;
    4.11 -}
    4.12 -
    4.13 -__attribute__((weak)) int xc_set_hvm_param(
    4.14 -    int handle, domid_t dom, int param, unsigned long value)
    4.15 -{
    4.16 -    return -ENOSYS;
    4.17 -}
    4.18 -
    4.19  /*
    4.20   * Local variables:
    4.21   * mode: C
     5.1 --- a/tools/python/xen/xm/xenapi_create.py	Thu Apr 12 10:30:12 2007 -0600
     5.2 +++ b/tools/python/xen/xm/xenapi_create.py	Fri Apr 13 11:11:41 2007 +0100
     5.3 @@ -48,7 +48,7 @@ def get_name_description(node):
     5.4  
     5.5  def get_text_in_child_node(node, child):
     5.6      tag_node = node.getElementsByTagName(child)[0]
     5.7 -    return tag_node.nodeValue
     5.8 +    return " ".join([child.nodeValue for child in tag_node.childNodes])
     5.9  
    5.10  def get_child_node_attribute(node, child, attribute):
    5.11      tag_node = node.getElementsByTagName(child)[0]
    5.12 @@ -264,7 +264,23 @@ class xenapi_create:
    5.13              "platform":
    5.14                  get_child_nodes_as_dict(vm, "platform", "key", "value"),
    5.15              "other_config":
    5.16 -                get_child_nodes_as_dict(vm, "other_config", "key", "value")
    5.17 +                get_child_nodes_as_dict(vm, "other_config", "key", "value"),
    5.18 +            "PV_bootloader":
    5.19 +                "",
    5.20 +            "PV_kernel":
    5.21 +                "",
    5.22 +            "PV_ramdisk":
    5.23 +                "",
    5.24 +            "PV_args":
    5.25 +                "",
    5.26 +            "PV_bootloader_args":
    5.27 +                "",
    5.28 +            "HVM_boot_policy":
    5.29 +                "",
    5.30 +            "HVM_boot_params":
    5.31 +                {},
    5.32 +            "PCI_bus":
    5.33 +               ""
    5.34              }
    5.35  
    5.36          if len(vm.getElementsByTagName("pv")) > 0:
    5.37 @@ -494,7 +510,7 @@ class sxp2xml:
    5.38          # Make version tag
    5.39  
    5.40          version = document.createElement("version")
    5.41 -        version.appendChild(document.createTextNode("1.0"))
    5.42 +        version.appendChild(document.createTextNode("0"))
    5.43          vm.appendChild(version)
    5.44          
    5.45          # Make pv or hvm tag
     6.1 --- a/xen/arch/x86/hvm/hvm.c	Thu Apr 12 10:30:12 2007 -0600
     6.2 +++ b/xen/arch/x86/hvm/hvm.c	Fri Apr 13 11:11:41 2007 +0100
     6.3 @@ -191,6 +191,7 @@ static int hvm_save_cpu_ctxt(struct doma
     6.4  {
     6.5      struct vcpu *v;
     6.6      struct hvm_hw_cpu ctxt;
     6.7 +    struct vcpu_guest_context *vc;
     6.8  
     6.9      for_each_vcpu(d, v)
    6.10      {
    6.11 @@ -199,7 +200,40 @@ static int hvm_save_cpu_ctxt(struct doma
    6.12          if ( test_bit(_VPF_down, &v->pause_flags) ) 
    6.13              continue;
    6.14  
    6.15 +        /* Architecture-specific vmcs/vmcb bits */
    6.16          hvm_funcs.save_cpu_ctxt(v, &ctxt);
    6.17 +
    6.18 +        /* Other vcpu register state */
    6.19 +        vc = &v->arch.guest_context;
    6.20 +        if ( vc->flags & VGCF_i387_valid )
    6.21 +            memcpy(ctxt.fpu_regs, &vc->fpu_ctxt, sizeof(ctxt.fpu_regs));
    6.22 +        else 
    6.23 +            memset(ctxt.fpu_regs, 0, sizeof(ctxt.fpu_regs));
    6.24 +        ctxt.rax = vc->user_regs.eax;
    6.25 +        ctxt.rbx = vc->user_regs.ebx;
    6.26 +        ctxt.rcx = vc->user_regs.ecx;
    6.27 +        ctxt.rdx = vc->user_regs.edx;
    6.28 +        ctxt.rbp = vc->user_regs.ebp;
    6.29 +        ctxt.rsi = vc->user_regs.esi;
    6.30 +        ctxt.rdi = vc->user_regs.edi;
    6.31 +        /* %rsp handled by arch-specific call above */
    6.32 +#ifdef __x86_64__        
    6.33 +        ctxt.r8  = vc->user_regs.r8;
    6.34 +        ctxt.r9  = vc->user_regs.r9;
    6.35 +        ctxt.r10 = vc->user_regs.r10;
    6.36 +        ctxt.r11 = vc->user_regs.r11;
    6.37 +        ctxt.r12 = vc->user_regs.r12;
    6.38 +        ctxt.r13 = vc->user_regs.r13;
    6.39 +        ctxt.r14 = vc->user_regs.r14;
    6.40 +        ctxt.r15 = vc->user_regs.r15;
    6.41 +#endif
    6.42 +        ctxt.dr0 = vc->debugreg[0];
    6.43 +        ctxt.dr1 = vc->debugreg[1];
    6.44 +        ctxt.dr2 = vc->debugreg[2];
    6.45 +        ctxt.dr3 = vc->debugreg[3];
    6.46 +        ctxt.dr6 = vc->debugreg[6];
    6.47 +        ctxt.dr7 = vc->debugreg[7];
    6.48 +
    6.49          if ( hvm_save_entry(CPU, v->vcpu_id, h, &ctxt) != 0 )
    6.50              return 1; 
    6.51      }
    6.52 @@ -208,9 +242,10 @@ static int hvm_save_cpu_ctxt(struct doma
    6.53  
    6.54  static int hvm_load_cpu_ctxt(struct domain *d, hvm_domain_context_t *h)
    6.55  {
    6.56 -    int vcpuid;
    6.57 +    int vcpuid, rc;
    6.58      struct vcpu *v;
    6.59      struct hvm_hw_cpu ctxt;
    6.60 +    struct vcpu_guest_context *vc;
    6.61  
    6.62      /* Which vcpu is this? */
    6.63      vcpuid = hvm_load_instance(h);
    6.64 @@ -219,13 +254,52 @@ static int hvm_load_cpu_ctxt(struct doma
    6.65          gdprintk(XENLOG_ERR, "HVM restore: domain has no vcpu %u\n", vcpuid);
    6.66          return -EINVAL;
    6.67      }
    6.68 +    vc = &v->arch.guest_context;
    6.69 +
    6.70 +    /* Need to init this vcpu before loading its contents */
    6.71 +    LOCK_BIGLOCK(d);
    6.72 +    if ( !v->is_initialised )
    6.73 +        if ( (rc = boot_vcpu(d, vcpuid, vc)) != 0 )
    6.74 +            return rc;
    6.75 +    UNLOCK_BIGLOCK(d);
    6.76  
    6.77      if ( hvm_load_entry(CPU, h, &ctxt) != 0 ) 
    6.78          return -EINVAL;
    6.79  
    6.80 +    /* Architecture-specific vmcs/vmcb bits */
    6.81      if ( hvm_funcs.load_cpu_ctxt(v, &ctxt) < 0 )
    6.82          return -EINVAL;
    6.83  
    6.84 +    /* Other vcpu register state */
    6.85 +    memcpy(&vc->fpu_ctxt, ctxt.fpu_regs, sizeof(ctxt.fpu_regs));
    6.86 +    vc->user_regs.eax = ctxt.rax;
    6.87 +    vc->user_regs.ebx = ctxt.rbx;
    6.88 +    vc->user_regs.ecx = ctxt.rcx;
    6.89 +    vc->user_regs.edx = ctxt.rdx;
    6.90 +    vc->user_regs.ebp = ctxt.rbp;
    6.91 +    vc->user_regs.esi = ctxt.rsi;
    6.92 +    vc->user_regs.edi = ctxt.rdi;
    6.93 +    vc->user_regs.esp = ctxt.rsp;
    6.94 +#ifdef __x86_64__
    6.95 +    vc->user_regs.r8  = ctxt.r8; 
    6.96 +    vc->user_regs.r9  = ctxt.r9; 
    6.97 +    vc->user_regs.r10 = ctxt.r10;
    6.98 +    vc->user_regs.r11 = ctxt.r11;
    6.99 +    vc->user_regs.r12 = ctxt.r12;
   6.100 +    vc->user_regs.r13 = ctxt.r13;
   6.101 +    vc->user_regs.r14 = ctxt.r14;
   6.102 +    vc->user_regs.r15 = ctxt.r15;
   6.103 +#endif
   6.104 +    vc->debugreg[0] = ctxt.dr0;
   6.105 +    vc->debugreg[1] = ctxt.dr1;
   6.106 +    vc->debugreg[2] = ctxt.dr2;
   6.107 +    vc->debugreg[3] = ctxt.dr3;
   6.108 +    vc->debugreg[6] = ctxt.dr6;
   6.109 +    vc->debugreg[7] = ctxt.dr7;
   6.110 +
   6.111 +    vc->flags = VGCF_i387_valid | VGCF_online;
   6.112 +    v->fpu_initialised = 1;
   6.113 +
   6.114      /* Auxiliary processors should be woken immediately. */
   6.115      if ( test_and_clear_bit(_VPF_down, &v->pause_flags) )
   6.116          vcpu_wake(v);
     7.1 --- a/xen/arch/x86/hvm/svm/svm.c	Thu Apr 12 10:30:12 2007 -0600
     7.2 +++ b/xen/arch/x86/hvm/svm/svm.c	Fri Apr 13 11:11:41 2007 +0100
     7.3 @@ -233,7 +233,7 @@ int svm_vmcb_save(struct vcpu *v, struct
     7.4  {
     7.5      struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
     7.6  
     7.7 -    c->eip = vmcb->rip;
     7.8 +    c->rip = vmcb->rip;
     7.9  
    7.10  #ifdef HVM_DEBUG_SUSPEND
    7.11      printk("%s: eip=0x%"PRIx64".\n", 
    7.12 @@ -241,10 +241,11 @@ int svm_vmcb_save(struct vcpu *v, struct
    7.13             inst_len, c->eip);
    7.14  #endif
    7.15  
    7.16 -    c->esp = vmcb->rsp;
    7.17 -    c->eflags = vmcb->rflags;
    7.18 +    c->rsp = vmcb->rsp;
    7.19 +    c->rflags = vmcb->rflags;
    7.20  
    7.21      c->cr0 = v->arch.hvm_svm.cpu_shadow_cr0;
    7.22 +    c->cr2 = v->arch.hvm_svm.cpu_cr2;
    7.23      c->cr3 = v->arch.hvm_svm.cpu_cr3;
    7.24      c->cr4 = v->arch.hvm_svm.cpu_shadow_cr4;
    7.25  
    7.26 @@ -315,15 +316,17 @@ int svm_vmcb_restore(struct vcpu *v, str
    7.27      unsigned long mfn, old_base_mfn;
    7.28      struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
    7.29  
    7.30 -    vmcb->rip    = c->eip;
    7.31 -    vmcb->rsp    = c->esp;
    7.32 -    vmcb->rflags = c->eflags;
    7.33 +    vmcb->rip    = c->rip;
    7.34 +    vmcb->rsp    = c->rsp;
    7.35 +    vmcb->rflags = c->rflags;
    7.36  
    7.37      v->arch.hvm_svm.cpu_shadow_cr0 = c->cr0;
    7.38      vmcb->cr0 = c->cr0 | X86_CR0_WP | X86_CR0_ET;
    7.39      if ( !paging_mode_hap(v->domain) ) 
    7.40          vmcb->cr0 |= X86_CR0_PG;
    7.41  
    7.42 +    v->arch.hvm_svm.cpu_cr2 = c->cr2;
    7.43 +
    7.44  #ifdef HVM_DEBUG_SUSPEND
    7.45      printk("%s: cr3=0x%"PRIx64", cr0=0x%"PRIx64", cr4=0x%"PRIx64".\n",
    7.46             __func__,
    7.47 @@ -421,6 +424,9 @@ int svm_vmcb_restore(struct vcpu *v, str
    7.48      vmcb->sysenter_esp = c->sysenter_esp;
    7.49      vmcb->sysenter_eip = c->sysenter_eip;
    7.50  
    7.51 +    vmcb->dr6 = c->dr6;
    7.52 +    vmcb->dr7 = c->dr7;
    7.53 +
    7.54      paging_update_paging_modes(v);
    7.55      return 0;
    7.56   
    7.57 @@ -440,6 +446,7 @@ void svm_save_cpu_state(struct vcpu *v, 
    7.58      data->msr_cstar        = vmcb->cstar;
    7.59      data->msr_syscall_mask = vmcb->sfmask;
    7.60      data->msr_efer         = v->arch.hvm_svm.cpu_shadow_efer;
    7.61 +    data->msr_flags        = -1ULL;
    7.62  
    7.63      data->tsc = hvm_get_guest_time(v);
    7.64  }
     8.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Thu Apr 12 10:30:12 2007 -0600
     8.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Fri Apr 13 11:11:41 2007 +0100
     8.3 @@ -370,11 +370,12 @@ static inline void __restore_debug_regis
     8.4  
     8.5  int vmx_vmcs_save(struct vcpu *v, struct hvm_hw_cpu *c)
     8.6  {    
     8.7 -    c->eip = __vmread(GUEST_RIP);
     8.8 -    c->esp = __vmread(GUEST_RSP);
     8.9 -    c->eflags = __vmread(GUEST_RFLAGS);
    8.10 +    c->rip = __vmread(GUEST_RIP);
    8.11 +    c->rsp = __vmread(GUEST_RSP);
    8.12 +    c->rflags = __vmread(GUEST_RFLAGS);
    8.13  
    8.14      c->cr0 = v->arch.hvm_vmx.cpu_shadow_cr0;
    8.15 +    c->cr2 = v->arch.hvm_vmx.cpu_cr2;
    8.16      c->cr3 = v->arch.hvm_vmx.cpu_cr3;
    8.17      c->cr4 = v->arch.hvm_vmx.cpu_shadow_cr4;
    8.18  
    8.19 @@ -444,13 +445,15 @@ int vmx_vmcs_restore(struct vcpu *v, str
    8.20  
    8.21      vmx_vmcs_enter(v);
    8.22  
    8.23 -    __vmwrite(GUEST_RIP, c->eip);
    8.24 -    __vmwrite(GUEST_RSP, c->esp);
    8.25 -    __vmwrite(GUEST_RFLAGS, c->eflags);
    8.26 +    __vmwrite(GUEST_RIP, c->rip);
    8.27 +    __vmwrite(GUEST_RSP, c->rsp);
    8.28 +    __vmwrite(GUEST_RFLAGS, c->rflags);
    8.29  
    8.30      v->arch.hvm_vmx.cpu_shadow_cr0 = c->cr0;
    8.31      __vmwrite(CR0_READ_SHADOW, v->arch.hvm_vmx.cpu_shadow_cr0);
    8.32  
    8.33 +    v->arch.hvm_vmx.cpu_cr2 = c->cr2;
    8.34 +
    8.35  #ifdef HVM_DEBUG_SUSPEND
    8.36      printk("vmx_vmcs_restore: cr3=0x%"PRIx64", cr0=0x%"PRIx64", cr4=0x%"PRIx64".\n",
    8.37              c->cr3,
    8.38 @@ -555,6 +558,8 @@ int vmx_vmcs_restore(struct vcpu *v, str
    8.39      __vmwrite(GUEST_SYSENTER_ESP, c->sysenter_esp);
    8.40      __vmwrite(GUEST_SYSENTER_EIP, c->sysenter_eip);
    8.41  
    8.42 +    __vmwrite(GUEST_DR7, c->dr7);
    8.43 +
    8.44      vmx_vmcs_exit(v);
    8.45  
    8.46      paging_update_paging_modes(v);
    8.47 @@ -590,7 +595,7 @@ void vmx_save_cpu_state(struct vcpu *v, 
    8.48      data->shadow_gs = guest_state->shadow_gs;
    8.49  
    8.50      /* save msrs */
    8.51 -    data->flags = guest_flags;
    8.52 +    data->msr_flags        = guest_flags;
    8.53      data->msr_lstar        = guest_state->msrs[VMX_INDEX_MSR_LSTAR];
    8.54      data->msr_star         = guest_state->msrs[VMX_INDEX_MSR_STAR];
    8.55      data->msr_cstar        = guest_state->msrs[VMX_INDEX_MSR_CSTAR];
    8.56 @@ -607,7 +612,7 @@ void vmx_load_cpu_state(struct vcpu *v, 
    8.57      struct vmx_msr_state *guest_state = &v->arch.hvm_vmx.msr_state;
    8.58  
    8.59      /* restore msrs */
    8.60 -    guest_state->flags = data->flags;
    8.61 +    guest_state->flags = data->msr_flags;
    8.62      guest_state->msrs[VMX_INDEX_MSR_LSTAR]        = data->msr_lstar;
    8.63      guest_state->msrs[VMX_INDEX_MSR_STAR]         = data->msr_star;
    8.64      guest_state->msrs[VMX_INDEX_MSR_CSTAR]        = data->msr_cstar;
     9.1 --- a/xen/include/public/hvm/save.h	Thu Apr 12 10:30:12 2007 -0600
     9.2 +++ b/xen/include/public/hvm/save.h	Fri Apr 13 11:11:41 2007 +0100
     9.3 @@ -87,13 +87,40 @@ DECLARE_HVM_SAVE_TYPE(HEADER, 1, struct 
     9.4   */
     9.5  
     9.6  struct hvm_hw_cpu {
     9.7 -    uint64_t eip;
     9.8 -    uint64_t esp;
     9.9 -    uint64_t eflags;
    9.10 +    uint8_t  fpu_regs[512];
    9.11 +
    9.12 +    uint64_t rax;
    9.13 +    uint64_t rbx;
    9.14 +    uint64_t rcx;
    9.15 +    uint64_t rdx;
    9.16 +    uint64_t rbp;
    9.17 +    uint64_t rsi;
    9.18 +    uint64_t rdi;
    9.19 +    uint64_t rsp;
    9.20 +    uint64_t r8;
    9.21 +    uint64_t r9;
    9.22 +    uint64_t r10;
    9.23 +    uint64_t r11;
    9.24 +    uint64_t r12;
    9.25 +    uint64_t r13;
    9.26 +    uint64_t r14;
    9.27 +    uint64_t r15;
    9.28 +
    9.29 +    uint64_t rip;
    9.30 +    uint64_t rflags;
    9.31 +
    9.32      uint64_t cr0;
    9.33 +    uint64_t cr2;
    9.34      uint64_t cr3;
    9.35      uint64_t cr4;
    9.36  
    9.37 +    uint64_t dr0;
    9.38 +    uint64_t dr1;
    9.39 +    uint64_t dr2;
    9.40 +    uint64_t dr3;
    9.41 +    uint64_t dr6;
    9.42 +    uint64_t dr7;    
    9.43 +
    9.44      uint32_t cs_sel;
    9.45      uint32_t ds_sel;
    9.46      uint32_t es_sel;
    9.47 @@ -142,9 +169,9 @@ struct hvm_hw_cpu {
    9.48  
    9.49      /* msr for em64t */
    9.50      uint64_t shadow_gs;
    9.51 -    uint64_t flags;
    9.52  
    9.53      /* msr content saved/restored. */
    9.54 +    uint64_t msr_flags;
    9.55      uint64_t msr_lstar;
    9.56      uint64_t msr_star;
    9.57      uint64_t msr_cstar;