direct-io.hg

changeset 7242:ddb803b6308b

Move construct_vmcs to arch_vmx_do_launch.

Currently, since VMX guest is brought up by xen0, construct_vmcs is
executed in xen0 hypervisor context, this is not reasonable. This=20
patch moves construct_vmcs to arch_vmx_do_launch.

Signed-off-by: Xin Li <xin.b.li@intel.com>
Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Signed-off-by: Nakajima Jun <nakajima.jun@intel.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri Oct 07 11:00:56 2005 +0100 (2005-10-07)
parents 37bea65ed6ca
children f3c590641000 306f6ec86ea8
files xen/arch/x86/domain.c xen/arch/x86/vmx.c xen/arch/x86/vmx_vmcs.c xen/include/asm-x86/vmx.h xen/include/asm-x86/vmx_vmcs.h
line diff
     1.1 --- a/xen/arch/x86/domain.c	Fri Oct 07 10:57:13 2005 +0100
     1.2 +++ b/xen/arch/x86/domain.c	Fri Oct 07 11:00:56 2005 +0100
     1.3 @@ -323,47 +323,16 @@ void vcpu_migrate_cpu(struct vcpu *v, in
     1.4  #ifdef CONFIG_VMX
     1.5  static int vmx_switch_on;
     1.6  
     1.7 -static int vmx_final_setup_guest(
     1.8 -    struct vcpu *v, struct vcpu_guest_context *ctxt)
     1.9 +static void vmx_final_setup_guest(struct vcpu *v)
    1.10  {
    1.11 -    int error;
    1.12 -    struct cpu_user_regs *regs;
    1.13 -    struct vmcs_struct *vmcs;
    1.14 -
    1.15 -    regs = &ctxt->user_regs;
    1.16 -
    1.17 -    /*
    1.18 -     * Create a new VMCS
    1.19 -     */
    1.20 -    if (!(vmcs = alloc_vmcs())) {
    1.21 -        printk("Failed to create a new VMCS\n");
    1.22 -        return -ENOMEM;
    1.23 -    }
    1.24 -
    1.25 -    memset(&v->arch.arch_vmx, 0, sizeof (struct arch_vmx_struct));
    1.26 -
    1.27 -    v->arch.arch_vmx.vmcs = vmcs;
    1.28 -    error = construct_vmcs(
    1.29 -        &v->arch.arch_vmx, regs, ctxt, VMCS_USE_HOST_ENV);
    1.30 -    if ( error < 0 )
    1.31 -    {
    1.32 -        printk("Failed to construct a new VMCS\n");
    1.33 -        goto out;
    1.34 -    }
    1.35 -
    1.36      v->arch.schedule_tail = arch_vmx_do_launch;
    1.37  
    1.38 -#if defined (__i386__)
    1.39 -    v->domain->arch.vmx_platform.real_mode_data = 
    1.40 -        (unsigned long *) regs->esi;
    1.41 -#endif
    1.42 -
    1.43      if (v == v->domain->vcpu[0]) {
    1.44 -        /* 
    1.45 +        /*
    1.46           * Required to do this once per domain
    1.47           * XXX todo: add a seperate function to do these.
    1.48           */
    1.49 -        memset(&v->domain->shared_info->evtchn_mask[0], 0xff, 
    1.50 +        memset(&v->domain->shared_info->evtchn_mask[0], 0xff,
    1.51                 sizeof(v->domain->shared_info->evtchn_mask));
    1.52  
    1.53          /* Put the domain in shadow mode even though we're going to be using
    1.54 @@ -375,23 +344,6 @@ static int vmx_final_setup_guest(
    1.55  
    1.56      if (!vmx_switch_on)
    1.57          vmx_switch_on = 1;
    1.58 -
    1.59 -    return 0;
    1.60 -
    1.61 -out:
    1.62 -    free_vmcs(vmcs);
    1.63 -    if(v->arch.arch_vmx.io_bitmap_a != 0) {
    1.64 -        free_xenheap_pages(
    1.65 -            v->arch.arch_vmx.io_bitmap_a, get_order_from_bytes(0x1000));
    1.66 -        v->arch.arch_vmx.io_bitmap_a = 0;
    1.67 -    }
    1.68 -    if(v->arch.arch_vmx.io_bitmap_b != 0) {
    1.69 -        free_xenheap_pages(
    1.70 -            v->arch.arch_vmx.io_bitmap_b, get_order_from_bytes(0x1000));
    1.71 -        v->arch.arch_vmx.io_bitmap_b = 0;
    1.72 -    }
    1.73 -    v->arch.arch_vmx.vmcs = 0;
    1.74 -    return error;
    1.75  }
    1.76  #endif
    1.77  
    1.78 @@ -480,8 +432,7 @@ int arch_set_info_guest(
    1.79          if ( !pagetable_get_paddr(d->arch.phys_table) )
    1.80              d->arch.phys_table = v->arch.guest_table;
    1.81  
    1.82 -        if ( (rc = vmx_final_setup_guest(v, c)) != 0 )
    1.83 -            return rc;
    1.84 +        vmx_final_setup_guest(v);
    1.85      }
    1.86  
    1.87      update_pagetables(v);
    1.88 @@ -968,20 +919,7 @@ static void vmx_relinquish_resources(str
    1.89      if ( !VMX_DOMAIN(v) )
    1.90          return;
    1.91  
    1.92 -    BUG_ON(v->arch.arch_vmx.vmcs == NULL);
    1.93 -    free_vmcs(v->arch.arch_vmx.vmcs);
    1.94 -    if(v->arch.arch_vmx.io_bitmap_a != 0) {
    1.95 -        free_xenheap_pages(
    1.96 -            v->arch.arch_vmx.io_bitmap_a, get_order_from_bytes(0x1000));
    1.97 -        v->arch.arch_vmx.io_bitmap_a = 0;
    1.98 -    }
    1.99 -    if(v->arch.arch_vmx.io_bitmap_b != 0) {
   1.100 -        free_xenheap_pages(
   1.101 -            v->arch.arch_vmx.io_bitmap_b, get_order_from_bytes(0x1000));
   1.102 -        v->arch.arch_vmx.io_bitmap_b = 0;
   1.103 -    }
   1.104 -    v->arch.arch_vmx.vmcs = 0;
   1.105 -    
   1.106 +    destroy_vmcs(&v->arch.arch_vmx);
   1.107      free_monitor_pagetable(v);
   1.108      rem_ac_timer(&v->domain->arch.vmx_platform.vmx_pit.pit_timer);
   1.109  }
     2.1 --- a/xen/arch/x86/vmx.c	Fri Oct 07 10:57:13 2005 +0100
     2.2 +++ b/xen/arch/x86/vmx.c	Fri Oct 07 11:00:56 2005 +0100
     2.3 @@ -47,8 +47,6 @@
     2.4  int hvm_enabled;
     2.5  
     2.6  #ifdef CONFIG_VMX
     2.7 -
     2.8 -int vmcs_size;
     2.9  unsigned int opt_vmx_debug_level = 0;
    2.10  integer_param("vmx_debug", opt_vmx_debug_level);
    2.11  
     3.1 --- a/xen/arch/x86/vmx_vmcs.c	Fri Oct 07 10:57:13 2005 +0100
     3.2 +++ b/xen/arch/x86/vmx_vmcs.c	Fri Oct 07 11:00:56 2005 +0100
     3.3 @@ -37,6 +37,8 @@
     3.4  #endif
     3.5  #ifdef CONFIG_VMX
     3.6  
     3.7 +int vmcs_size;
     3.8 +
     3.9  struct vmcs_struct *alloc_vmcs(void)
    3.10  {
    3.11      struct vmcs_struct *vmcs;
    3.12 @@ -51,7 +53,7 @@ struct vmcs_struct *alloc_vmcs(void)
    3.13      return vmcs;
    3.14  }
    3.15  
    3.16 -void free_vmcs(struct vmcs_struct *vmcs)
    3.17 +static void free_vmcs(struct vmcs_struct *vmcs)
    3.18  {
    3.19      int order;
    3.20  
    3.21 @@ -59,6 +61,28 @@ void free_vmcs(struct vmcs_struct *vmcs)
    3.22      free_xenheap_pages(vmcs, order);
    3.23  }
    3.24  
    3.25 +static int load_vmcs(struct arch_vmx_struct *arch_vmx, u64 phys_ptr)
    3.26 +{
    3.27 +    int error;
    3.28 +
    3.29 +    if ((error = __vmptrld(phys_ptr))) {
    3.30 +        clear_bit(ARCH_VMX_VMCS_LOADED, &arch_vmx->flags);
    3.31 +        return error;
    3.32 +    }
    3.33 +    set_bit(ARCH_VMX_VMCS_LOADED, &arch_vmx->flags);
    3.34 +    return 0;
    3.35 +}
    3.36 +
    3.37 +#if 0
    3.38 +static int store_vmcs(struct arch_vmx_struct *arch_vmx, u64 phys_ptr)
    3.39 +{
    3.40 +    /* take the current VMCS */
    3.41 +    __vmptrst(phys_ptr);
    3.42 +    clear_bit(ARCH_VMX_VMCS_LOADED, &arch_vmx->flags);
    3.43 +    return 0;
    3.44 +}
    3.45 +#endif
    3.46 +
    3.47  static inline int construct_vmcs_controls(struct arch_vmx_struct *arch_vmx)
    3.48  {
    3.49      int error = 0;
    3.50 @@ -118,7 +142,7 @@ struct host_execution_env {
    3.51  #endif
    3.52  };
    3.53  
    3.54 -static void vmx_setup_platform(struct vcpu *v, struct cpu_user_regs *regs)
    3.55 +static void vmx_setup_platform(struct vcpu *v)
    3.56  {
    3.57      int i;
    3.58      unsigned char e820_map_nr;
    3.59 @@ -161,9 +185,6 @@ static void vmx_setup_platform(struct vc
    3.60      }
    3.61      unmap_domain_page(p);
    3.62  
    3.63 -    if (v->vcpu_id)
    3.64 -        return;
    3.65 -
    3.66      /* Initialise shared page */
    3.67      mpfn = get_mfn_from_pfn(gpfn);
    3.68      if (mpfn == INVALID_MFN) {
    3.69 @@ -184,7 +205,7 @@ static void vmx_setup_platform(struct vc
    3.70                &v->domain->shared_info->evtchn_mask[0]);
    3.71  }
    3.72  
    3.73 -void vmx_set_host_env(struct vcpu *v)
    3.74 +static void vmx_set_host_env(struct vcpu *v)
    3.75  {
    3.76      unsigned int tr, cpu, error = 0;
    3.77      struct host_execution_env host_env;
    3.78 @@ -209,14 +230,13 @@ void vmx_set_host_env(struct vcpu *v)
    3.79      error |= __vmwrite(HOST_TR_BASE, host_env.tr_base);
    3.80  }
    3.81  
    3.82 -void vmx_do_launch(struct vcpu *v)
    3.83 +static void vmx_do_launch(struct vcpu *v)
    3.84  {
    3.85  /* Update CR3, GDT, LDT, TR */
    3.86      unsigned int  error = 0;
    3.87      unsigned long pfn = 0;
    3.88      unsigned long cr0, cr4;
    3.89      struct pfn_info *page;
    3.90 -    struct cpu_user_regs *regs = guest_cpu_user_regs();
    3.91  
    3.92      __asm__ __volatile__ ("mov %%cr0,%0" : "=r" (cr0) : );
    3.93  
    3.94 @@ -246,7 +266,7 @@ void vmx_do_launch(struct vcpu *v)
    3.95      page = (struct pfn_info *) alloc_domheap_page(NULL);
    3.96      pfn = (unsigned long) (page - frame_table);
    3.97  
    3.98 -    vmx_setup_platform(v, regs);
    3.99 +    vmx_setup_platform(v);
   3.100  
   3.101      vmx_set_host_env(v);
   3.102  
   3.103 @@ -267,8 +287,7 @@ void vmx_do_launch(struct vcpu *v)
   3.104  /*
   3.105   * Initially set the same environement as host.
   3.106   */
   3.107 -static inline int
   3.108 -construct_init_vmcs_guest(struct cpu_user_regs *regs)
   3.109 +static inline int construct_init_vmcs_guest(cpu_user_regs_t *regs)
   3.110  {
   3.111      int error = 0;
   3.112      union vmcs_arbytes arbytes;
   3.113 @@ -374,34 +393,33 @@ construct_init_vmcs_guest(struct cpu_use
   3.114      return error;
   3.115  }
   3.116  
   3.117 -static inline int construct_vmcs_host(struct host_execution_env *host_env)
   3.118 +static inline int construct_vmcs_host()
   3.119  {
   3.120      int error = 0;
   3.121 +#ifdef __x86_64__
   3.122 +    unsigned long fs_base;
   3.123 +    unsigned long gs_base;
   3.124 +#endif
   3.125      unsigned long crn;
   3.126  
   3.127      /* Host Selectors */
   3.128 -    host_env->ds_selector = __HYPERVISOR_DS;
   3.129 -    error |= __vmwrite(HOST_ES_SELECTOR, host_env->ds_selector);
   3.130 -    error |= __vmwrite(HOST_SS_SELECTOR, host_env->ds_selector);
   3.131 -    error |= __vmwrite(HOST_DS_SELECTOR, host_env->ds_selector);
   3.132 +    error |= __vmwrite(HOST_ES_SELECTOR, __HYPERVISOR_DS);
   3.133 +    error |= __vmwrite(HOST_SS_SELECTOR, __HYPERVISOR_DS);
   3.134 +    error |= __vmwrite(HOST_DS_SELECTOR, __HYPERVISOR_DS);
   3.135  #if defined (__i386__)
   3.136 -    error |= __vmwrite(HOST_FS_SELECTOR, host_env->ds_selector);
   3.137 -    error |= __vmwrite(HOST_GS_SELECTOR, host_env->ds_selector);
   3.138 -    error |= __vmwrite(HOST_FS_BASE, host_env->ds_base);
   3.139 -    error |= __vmwrite(HOST_GS_BASE, host_env->ds_base);
   3.140 +    error |= __vmwrite(HOST_FS_SELECTOR, __HYPERVISOR_DS);
   3.141 +    error |= __vmwrite(HOST_GS_SELECTOR, __HYPERVISOR_DS);
   3.142 +    error |= __vmwrite(HOST_FS_BASE, 0);
   3.143 +    error |= __vmwrite(HOST_GS_BASE, 0);
   3.144  
   3.145  #else
   3.146 -    rdmsrl(MSR_FS_BASE, host_env->fs_base);
   3.147 -    rdmsrl(MSR_GS_BASE, host_env->gs_base);
   3.148 -    error |= __vmwrite(HOST_FS_BASE, host_env->fs_base);
   3.149 -    error |= __vmwrite(HOST_GS_BASE, host_env->gs_base);
   3.150 +    rdmsrl(MSR_FS_BASE, fs_base);
   3.151 +    rdmsrl(MSR_GS_BASE, gs_base);
   3.152 +    error |= __vmwrite(HOST_FS_BASE, fs_base);
   3.153 +    error |= __vmwrite(HOST_GS_BASE, gs_base);
   3.154  
   3.155  #endif
   3.156 -    host_env->cs_selector = __HYPERVISOR_CS;
   3.157 -    error |= __vmwrite(HOST_CS_SELECTOR, host_env->cs_selector);
   3.158 -
   3.159 -    host_env->ds_base = 0;
   3.160 -    host_env->cs_base = 0;
   3.161 +    error |= __vmwrite(HOST_CS_SELECTOR, __HYPERVISOR_CS);
   3.162  
   3.163      __asm__ __volatile__ ("mov %%cr0,%0" : "=r" (crn) : );
   3.164      error |= __vmwrite(HOST_CR0, crn); /* same CR0 */
   3.165 @@ -423,55 +441,58 @@ static inline int construct_vmcs_host(st
   3.166  
   3.167  /*
   3.168   * Need to extend to support full virtualization.
   3.169 - * The variable use_host_env indicates if the new VMCS needs to use
   3.170 - * the same setups as the host has (xenolinux).
   3.171   */
   3.172 -
   3.173 -int construct_vmcs(struct arch_vmx_struct *arch_vmx,
   3.174 -                   struct cpu_user_regs *regs,
   3.175 -                   struct vcpu_guest_context *ctxt,
   3.176 -                   int use_host_env)
   3.177 +static int construct_vmcs(struct arch_vmx_struct *arch_vmx,
   3.178 +                          cpu_user_regs_t *regs)
   3.179  {
   3.180      int error;
   3.181 +    long rc;
   3.182      u64 vmcs_phys_ptr;
   3.183  
   3.184 -    struct host_execution_env host_env;
   3.185 -
   3.186 -    if (use_host_env != VMCS_USE_HOST_ENV)
   3.187 -        return -EINVAL;
   3.188 -
   3.189 -    memset(&host_env, 0, sizeof(struct host_execution_env));
   3.190 -
   3.191 +    memset(arch_vmx, 0, sizeof(struct arch_vmx_struct));
   3.192 +    /*
   3.193 +     * Create a new VMCS
   3.194 +     */
   3.195 +    if (!(arch_vmx->vmcs = alloc_vmcs())) {
   3.196 +        printk("Failed to create a new VMCS\n");
   3.197 +        rc = -ENOMEM;
   3.198 +        goto err_out;
   3.199 +    }
   3.200      vmcs_phys_ptr = (u64) virt_to_phys(arch_vmx->vmcs);
   3.201  
   3.202 -    if ((error = __vmpclear (vmcs_phys_ptr))) {
   3.203 +    if ((error = __vmpclear(vmcs_phys_ptr))) {
   3.204          printk("construct_vmcs: VMCLEAR failed\n");
   3.205 -        return -EINVAL;
   3.206 +        rc = -EINVAL;
   3.207 +        goto err_out;
   3.208      }
   3.209      if ((error = load_vmcs(arch_vmx, vmcs_phys_ptr))) {
   3.210          printk("construct_vmcs: load_vmcs failed: VMCS = %lx\n",
   3.211                 (unsigned long) vmcs_phys_ptr);
   3.212 -        return -EINVAL;
   3.213 +        rc = -EINVAL;
   3.214 +        goto err_out;
   3.215      }
   3.216      if ((error = construct_vmcs_controls(arch_vmx))) {
   3.217          printk("construct_vmcs: construct_vmcs_controls failed\n");
   3.218 -        return -EINVAL;
   3.219 +        rc = -EINVAL;
   3.220 +        goto err_out;
   3.221      }
   3.222      /* host selectors */
   3.223 -    if ((error = construct_vmcs_host(&host_env))) {
   3.224 +    if ((error = construct_vmcs_host())) {
   3.225          printk("construct_vmcs: construct_vmcs_host failed\n");
   3.226 -        return -EINVAL;
   3.227 +        rc = -EINVAL;
   3.228 +        goto err_out;
   3.229      }
   3.230      /* guest selectors */
   3.231      if ((error = construct_init_vmcs_guest(regs))) {
   3.232          printk("construct_vmcs: construct_vmcs_guest failed\n");
   3.233 -        return -EINVAL;
   3.234 +        rc = -EINVAL;
   3.235 +        goto err_out;
   3.236      }
   3.237 -
   3.238      if ((error |= __vmwrite(EXCEPTION_BITMAP,
   3.239                              MONITOR_DEFAULT_EXCEPTION_BITMAP))) {
   3.240          printk("construct_vmcs: setting Exception bitmap failed\n");
   3.241 -        return -EINVAL;
   3.242 +        rc = -EINVAL;
   3.243 +        goto err_out;
   3.244      }
   3.245  
   3.246      if (regs->eflags & EF_TF)
   3.247 @@ -480,6 +501,27 @@ int construct_vmcs(struct arch_vmx_struc
   3.248          __vm_clear_bit(EXCEPTION_BITMAP, EXCEPTION_BITMAP_DB);
   3.249  
   3.250      return 0;
   3.251 +
   3.252 +err_out:
   3.253 +    destroy_vmcs(arch_vmx);
   3.254 +    return rc;
   3.255 +}
   3.256 +
   3.257 +void destroy_vmcs(struct arch_vmx_struct *arch_vmx)
   3.258 +{
   3.259 +    if(arch_vmx->vmcs != NULL)
   3.260 +        free_vmcs(arch_vmx->vmcs);
   3.261 +    if(arch_vmx->io_bitmap_a != 0) {
   3.262 +        free_xenheap_pages(
   3.263 +            arch_vmx->io_bitmap_a, get_order_from_bytes(0x1000));
   3.264 +        arch_vmx->io_bitmap_a = 0;
   3.265 +    }
   3.266 +    if(arch_vmx->io_bitmap_b != 0) {
   3.267 +        free_xenheap_pages(
   3.268 +            arch_vmx->io_bitmap_b, get_order_from_bytes(0x1000));
   3.269 +        arch_vmx->io_bitmap_b = 0;
   3.270 +    }
   3.271 +    arch_vmx->vmcs = 0;
   3.272  }
   3.273  
   3.274  /*
   3.275 @@ -506,26 +548,6 @@ int modify_vmcs(struct arch_vmx_struct *
   3.276      return 0;
   3.277  }
   3.278  
   3.279 -int load_vmcs(struct arch_vmx_struct *arch_vmx, u64 phys_ptr)
   3.280 -{
   3.281 -    int error;
   3.282 -
   3.283 -    if ((error = __vmptrld(phys_ptr))) {
   3.284 -        clear_bit(ARCH_VMX_VMCS_LOADED, &arch_vmx->flags);
   3.285 -        return error;
   3.286 -    }
   3.287 -    set_bit(ARCH_VMX_VMCS_LOADED, &arch_vmx->flags);
   3.288 -    return 0;
   3.289 -}
   3.290 -
   3.291 -int store_vmcs(struct arch_vmx_struct *arch_vmx, u64 phys_ptr)
   3.292 -{
   3.293 -    /* take the current VMCS */
   3.294 -    __vmptrst(phys_ptr);
   3.295 -    clear_bit(ARCH_VMX_VMCS_LOADED, &arch_vmx->flags);
   3.296 -    return 0;
   3.297 -}
   3.298 -
   3.299  void vm_launch_fail(unsigned long eflags)
   3.300  {
   3.301      unsigned long error;
   3.302 @@ -553,9 +575,19 @@ void arch_vmx_do_resume(struct vcpu *v)
   3.303  
   3.304  void arch_vmx_do_launch(struct vcpu *v)
   3.305  {
   3.306 -    u64 vmcs_phys_ptr = (u64) virt_to_phys(v->arch.arch_vmx.vmcs);
   3.307 +    int error;
   3.308 +    cpu_user_regs_t *regs = &current->arch.guest_context.user_regs;
   3.309  
   3.310 -    load_vmcs(&v->arch.arch_vmx, vmcs_phys_ptr);
   3.311 +    error = construct_vmcs(&v->arch.arch_vmx, regs);
   3.312 +    if ( error < 0 )
   3.313 +    {
   3.314 +        if (v->vcpu_id == 0) {
   3.315 +            printk("Failed to construct a new VMCS for BSP.\n");
   3.316 +        } else {
   3.317 +            printk("Failed to construct a new VMCS for AP %d\n", v->vcpu_id);
   3.318 +        }
   3.319 +        domain_crash_synchronous();
   3.320 +    }
   3.321      vmx_do_launch(v);
   3.322      reset_stack_and_jump(vmx_asm_do_launch);
   3.323  }
     4.1 --- a/xen/include/asm-x86/vmx.h	Fri Oct 07 10:57:13 2005 +0100
     4.2 +++ b/xen/include/asm-x86/vmx.h	Fri Oct 07 11:00:56 2005 +0100
     4.3 @@ -39,7 +39,6 @@ extern void arch_vmx_do_launch(struct vc
     4.4  extern void arch_vmx_do_resume(struct vcpu *);
     4.5  extern void arch_vmx_do_relaunch(struct vcpu *);
     4.6  
     4.7 -extern int vmcs_size;
     4.8  extern unsigned int cpu_rev;
     4.9  
    4.10  /*
    4.11 @@ -449,7 +448,7 @@ static inline void vmx_stts(void)
    4.12         __vm_set_bit(EXCEPTION_BITMAP, EXCEPTION_BITMAP_NM);
    4.13  }
    4.14  
    4.15 -/* Works only for ed == current */
    4.16 +/* Works only for vcpu == current */
    4.17  static inline int vmx_paging_enabled(struct vcpu *v)
    4.18  {
    4.19      unsigned long cr0;
     5.1 --- a/xen/include/asm-x86/vmx_vmcs.h	Fri Oct 07 10:57:13 2005 +0100
     5.2 +++ b/xen/include/asm-x86/vmx_vmcs.h	Fri Oct 07 11:00:56 2005 +0100
     5.3 @@ -53,6 +53,8 @@ struct vmcs_struct {
     5.4      unsigned char data [0]; /* vmcs size is read from MSR */
     5.5  };
     5.6  
     5.7 +extern int vmcs_size;
     5.8 +
     5.9  enum { 
    5.10      VMX_INDEX_MSR_LSTAR = 0,
    5.11      VMX_INDEX_MSR_STAR,
    5.12 @@ -94,18 +96,11 @@ struct arch_vmx_struct {
    5.13  #define ARCH_VMX_VMCS_RESUME    2       /* Needs VMCS resume */
    5.14  #define ARCH_VMX_IO_WAIT        3       /* Waiting for I/O completion */
    5.15  
    5.16 -void vmx_do_launch(struct vcpu *); 
    5.17 -void vmx_do_resume(struct vcpu *); 
    5.18 -void vmx_set_host_env(struct vcpu *);
    5.19 -
    5.20 +void vmx_do_resume(struct vcpu *);
    5.21  struct vmcs_struct *alloc_vmcs(void);
    5.22 -void free_vmcs(struct vmcs_struct *);
    5.23 -int  load_vmcs(struct arch_vmx_struct *, u64);
    5.24 -int  store_vmcs(struct arch_vmx_struct *, u64);
    5.25 -int  construct_vmcs(struct arch_vmx_struct *, struct cpu_user_regs *, 
    5.26 -                    struct vcpu_guest_context *, int);
    5.27  int modify_vmcs(struct arch_vmx_struct *arch_vmx,
    5.28                  struct cpu_user_regs *regs);
    5.29 +void destroy_vmcs(struct arch_vmx_struct *arch_vmx);
    5.30  
    5.31  #define VMCS_USE_HOST_ENV       1
    5.32  #define VMCS_USE_SEPARATE_ENV   0