ia64/xen-unstable

changeset 6115:bf98996dded2

Separate out VMCS host state initialization from the rest

This is needed to support virtual cpu migration, because the host state
initialization is done on every migration, but the rest of the initialization
is done once per vcpu.

Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Signed-off-by: Arun Sharma <arun.sharma@intel.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Aug 11 21:01:36 2005 +0000 (2005-08-11)
parents d1034eae9708
children fb619858dfa9
files xen/arch/x86/vmx_vmcs.c
line diff
     1.1 --- a/xen/arch/x86/vmx_vmcs.c	Thu Aug 11 21:01:10 2005 +0000
     1.2 +++ b/xen/arch/x86/vmx_vmcs.c	Thu Aug 11 21:01:36 2005 +0000
     1.3 @@ -187,25 +187,13 @@ int vmx_setup_platform(struct vcpu *d, s
     1.4      return 0;
     1.5  }
     1.6  
     1.7 -void vmx_do_launch(struct vcpu *v) 
     1.8 +void vmx_set_host_env(struct vcpu *v)
     1.9  {
    1.10 -/* Update CR3, GDT, LDT, TR */
    1.11      unsigned int tr, cpu, error = 0;
    1.12      struct host_execution_env host_env;
    1.13      struct Xgt_desc_struct desc;
    1.14 -    unsigned long pfn = 0;
    1.15 -    struct pfn_info *page;
    1.16 -    struct cpu_user_regs *regs = guest_cpu_user_regs();
    1.17 -
    1.18 -    vmx_stts();
    1.19  
    1.20      cpu = smp_processor_id();
    1.21 -
    1.22 -    page = (struct pfn_info *) alloc_domheap_page(NULL);
    1.23 -    pfn = (unsigned long) (page - frame_table);
    1.24 -
    1.25 -    vmx_setup_platform(v, regs);
    1.26 -
    1.27      __asm__ __volatile__ ("sidt  (%0) \n" :: "a"(&desc) : "memory");
    1.28      host_env.idtr_limit = desc.size;
    1.29      host_env.idtr_base = desc.address;
    1.30 @@ -216,17 +204,36 @@ void vmx_do_launch(struct vcpu *v)
    1.31      host_env.gdtr_base = desc.address;
    1.32      error |= __vmwrite(HOST_GDTR_BASE, host_env.gdtr_base);
    1.33  
    1.34 +    __asm__ __volatile__ ("str  (%0) \n" :: "a"(&tr) : "memory");
    1.35 +    host_env.tr_selector = tr;
    1.36 +    host_env.tr_limit = sizeof(struct tss_struct);
    1.37 +    host_env.tr_base = (unsigned long) &init_tss[cpu];
    1.38 +    error |= __vmwrite(HOST_TR_SELECTOR, host_env.tr_selector);
    1.39 +    error |= __vmwrite(HOST_TR_BASE, host_env.tr_base);
    1.40 +
    1.41 +}
    1.42 +
    1.43 +void vmx_do_launch(struct vcpu *v) 
    1.44 +{
    1.45 +/* Update CR3, GDT, LDT, TR */
    1.46 +    unsigned int  error = 0;
    1.47 +    unsigned long pfn = 0;
    1.48 +    struct pfn_info *page;
    1.49 +    struct cpu_user_regs *regs = guest_cpu_user_regs();
    1.50 +
    1.51 +    vmx_stts();
    1.52 +
    1.53 +    page = (struct pfn_info *) alloc_domheap_page(NULL);
    1.54 +    pfn = (unsigned long) (page - frame_table);
    1.55 +
    1.56 +    vmx_setup_platform(v, regs);
    1.57 +
    1.58 +    vmx_set_host_env(v);
    1.59 +
    1.60      error |= __vmwrite(GUEST_LDTR_SELECTOR, 0);
    1.61      error |= __vmwrite(GUEST_LDTR_BASE, 0);
    1.62      error |= __vmwrite(GUEST_LDTR_LIMIT, 0);
    1.63          
    1.64 -    __asm__ __volatile__ ("str  (%0) \n" :: "a"(&tr) : "memory");
    1.65 -    host_env.tr_selector = tr;
    1.66 -    host_env.tr_limit = sizeof(struct tss_struct);
    1.67 -    host_env.tr_base = (unsigned long) &init_tss[cpu];
    1.68 -
    1.69 -    error |= __vmwrite(HOST_TR_SELECTOR, host_env.tr_selector);
    1.70 -    error |= __vmwrite(HOST_TR_BASE, host_env.tr_base);
    1.71      error |= __vmwrite(GUEST_TR_BASE, 0);
    1.72      error |= __vmwrite(GUEST_TR_LIMIT, 0xff);
    1.73