x86/vmx: Don't use rdmsr() to fill HOST_SYSENTER_{CS,EIP}
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 20 Oct 2017 13:56:23 +0000 (14:56 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 1 Dec 2017 19:03:27 +0000 (19:03 +0000)
These are compile-time constants, and don't need to be read back from
hardware.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
xen/arch/x86/hvm/vmx/vmcs.c

index 6042109071967ca248e13f2159b0672faff0e626..e7818caed041fc33a96e1e383b0a81e093e8f35e 100644 (file)
@@ -994,8 +994,6 @@ static void pi_desc_init(struct vcpu *v)
 static int construct_vmcs(struct vcpu *v)
 {
     struct domain *d = v->domain;
-    uint16_t sysenter_cs;
-    unsigned long sysenter_eip;
     u32 vmexit_ctl = vmx_vmexit_control;
     u32 vmentry_ctl = vmx_vmentry_control;
 
@@ -1155,10 +1153,8 @@ static int construct_vmcs(struct vcpu *v)
     __vmwrite(HOST_RIP, (unsigned long)vmx_asm_vmexit_handler);
 
     /* Host SYSENTER CS:RIP. */
-    rdmsrl(MSR_IA32_SYSENTER_CS, sysenter_cs);
-    __vmwrite(HOST_SYSENTER_CS, sysenter_cs);
-    rdmsrl(MSR_IA32_SYSENTER_EIP, sysenter_eip);
-    __vmwrite(HOST_SYSENTER_EIP, sysenter_eip);
+    __vmwrite(HOST_SYSENTER_CS, __HYPERVISOR_CS);
+    __vmwrite(HOST_SYSENTER_EIP, (unsigned long)sysenter_entry);
 
     /* MSR intercepts. */
     __vmwrite(VM_EXIT_MSR_LOAD_COUNT, 0);