From: Jack Lange Date: Thu, 26 May 2011 17:57:12 +0000 (-0500) Subject: removed active_vmcs_ptrs array and read the active VMCS directly from hardware. X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=9b82fd29e9dc2b85339938098f77d8cf3487b099;p=palacios-OLD.git removed active_vmcs_ptrs array and read the active VMCS directly from hardware. --- diff --git a/palacios/include/palacios/vmx_lowlevel.h b/palacios/include/palacios/vmx_lowlevel.h index ce6a440..c169139 100644 --- a/palacios/include/palacios/vmx_lowlevel.h +++ b/palacios/include/palacios/vmx_lowlevel.h @@ -97,17 +97,17 @@ static inline int vmcs_load(addr_t vmcs_ptr) { return VMX_SUCCESS; } -static inline int vmcs_store(addr_t vmcs_ptr) { - uint64_t vmcs_ptr_64 = (uint64_t)vmcs_ptr; +static inline addr_t vmcs_store() { + uint64_t vmcs_ptr = 0; __asm__ __volatile__ ( VMPTRST_OPCODE EAX_07_MODRM : - : "a"(&vmcs_ptr_64) + : "a"(&vmcs_ptr) : "memory"); - return VMX_SUCCESS; + return vmcs_ptr; } static inline int vmcs_read(vmcs_field_t vmcs_field, void * dst) { diff --git a/palacios/src/palacios/vmx.c b/palacios/src/palacios/vmx.c index 55f578a..106239f 100644 --- a/palacios/src/palacios/vmx.c +++ b/palacios/src/palacios/vmx.c @@ -47,7 +47,6 @@ static struct vmx_hw_info hw_info; extern v3_cpu_arch_t v3_cpu_types[]; -static addr_t active_vmcs_ptrs[V3_CONFIG_MAX_CPUS] = { [0 ... V3_CONFIG_MAX_CPUS - 1] = 0}; static addr_t host_vmcs_ptrs[V3_CONFIG_MAX_CPUS] = { [0 ... V3_CONFIG_MAX_CPUS - 1] = 0}; extern int v3_vmx_launch(struct v3_gprs * vm_regs, struct guest_info * info, struct v3_ctrl_regs * ctrl_regs); @@ -106,7 +105,6 @@ static int init_vmcs_bios(struct guest_info * core, struct vmx_data * vmx_state) PrintDebug("Loading VMCS\n"); vmx_ret = vmcs_load(vmx_state->vmcs_ptr_phys); - active_vmcs_ptrs[V3_Get_CPU()] = vmx_state->vmcs_ptr_phys; vmx_state->state = VMX_UNLAUNCHED; if (vmx_ret != VMX_SUCCESS) { @@ -755,9 +753,8 @@ int v3_vmx_enter(struct guest_info * info) { v3_disable_ints(); - if (active_vmcs_ptrs[V3_Get_CPU()] != vmx_info->vmcs_ptr_phys) { + if (vmcs_store() != vmx_info->vmcs_ptr_phys) { vmcs_load(vmx_info->vmcs_ptr_phys); - active_vmcs_ptrs[V3_Get_CPU()] = vmx_info->vmcs_ptr_phys; }