]> xenbits.xensource.com Git - xen.git/commitdiff
PVH dom0: set eflags resvd bit #1
authorMukesh Rathor <mukesh.rathor@oracle.com>
Wed, 13 Nov 2013 08:52:18 +0000 (09:52 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 13 Nov 2013 08:52:18 +0000 (09:52 +0100)
In this patch the eflags resv bit #1 is set in vmx_vmenter_helper. If
the bit is not set, the vmlaunch/resume will fail with guest state
invalid.

Signed-off-by: Mukesh Rathor <mukesh.rathor@oracle.com>
For consistency (i.e. even if perhaps not strictly needed) also do the
same on SVM.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/domain.c
xen/arch/x86/hvm/hvm.c
xen/arch/x86/hvm/svm/entry.S
xen/arch/x86/hvm/vmx/vmx.c
xen/include/asm-x86/processor.h

index 45e5afead7818eb437f589ecde4bc6dad257b801..a3868f926559aeae5deb99592677fd021fb0f9d5 100644 (file)
@@ -743,8 +743,6 @@ int arch_set_info_guest(
     for ( i = 0; i < ARRAY_SIZE(v->arch.debugreg); ++i )
         v->arch.debugreg[i] = c(debugreg[i]);
 
-    v->arch.user_regs.eflags |= 2;
-
     if ( has_hvm_container_vcpu(v) )
     {
         /*
index 3919590333a02960c998e6eeb6636bfc60e0ea17..6efdd8522fab080ce360dc968b67992fca65c1ba 100644 (file)
@@ -972,7 +972,7 @@ static int hvm_load_cpu_ctxt(struct domain *d, hvm_domain_context_t *h)
     v->arch.user_regs.edi = ctxt.rdi;
     v->arch.user_regs.esp = ctxt.rsp;
     v->arch.user_regs.eip = ctxt.rip;
-    v->arch.user_regs.eflags = ctxt.rflags | 2;
+    v->arch.user_regs.eflags = ctxt.rflags | X86_EFLAGS_MBS;
     v->arch.user_regs.r8  = ctxt.r8;
     v->arch.user_regs.r9  = ctxt.r9;
     v->arch.user_regs.r10 = ctxt.r10;
@@ -1170,8 +1170,6 @@ int hvm_vcpu_initialise(struct vcpu *v)
         (void(*)(unsigned long))hvm_assert_evtchn_irq,
         (unsigned long)v);
 
-    v->arch.user_regs.eflags = 2;
-
     v->arch.hvm_vcpu.inject_trap.vector = -1;
 
     if ( is_pvh_vcpu(v) )
@@ -3636,7 +3634,7 @@ void hvm_vcpu_reset_state(struct vcpu *v, uint16_t cs, uint16_t ip)
 
     v->arch.vgc_flags = VGCF_online;
     memset(&v->arch.user_regs, 0, sizeof(v->arch.user_regs));
-    v->arch.user_regs.eflags = 2;
+    v->arch.user_regs.eflags = X86_EFLAGS_MBS;
     v->arch.user_regs.edx = 0x00000f00;
     v->arch.user_regs.eip = ip;
     memset(&v->arch.debugreg, 0, sizeof(v->arch.debugreg));
index aeddf64984b3ce9d3a9ecd32be11882c8547a9b7..ef4d5f41020f0e2e14d0f3691fdd58a516f2623d 100644 (file)
@@ -76,6 +76,7 @@ UNLIKELY_END(svm_trace)
         mov  UREGS_rsp(%rsp),%rax
         mov  %rax,VMCB_rsp(%rcx)
         mov  UREGS_eflags(%rsp),%rax
+        or   $X86_EFLAGS_MBS,%rax
         mov  %rax,VMCB_rflags(%rcx)
 
         pop  %r15
index 1c91e098af3a0264af13e75e7194ccc517267ec3..f0132a46e112f2ca725243f8dbdc6cff8175c27d 100644 (file)
@@ -3048,7 +3048,7 @@ void vmx_vmenter_helper(const struct cpu_user_regs *regs)
 
     __vmwrite(GUEST_RIP,    regs->rip);
     __vmwrite(GUEST_RSP,    regs->rsp);
-    __vmwrite(GUEST_RFLAGS, regs->rflags);
+    __vmwrite(GUEST_RFLAGS, regs->rflags | X86_EFLAGS_MBS);
 }
 
 /*
index 551036db81fa5f3563118d07893cc2e7bca56dbe..73a320235f6c0600cce64eed79cb601aad3fcb9f 100644 (file)
@@ -35,6 +35,7 @@
  * EFLAGS bits
  */
 #define X86_EFLAGS_CF  0x00000001 /* Carry Flag */
+#define X86_EFLAGS_MBS 0x00000002 /* Resvd bit */
 #define X86_EFLAGS_PF  0x00000004 /* Parity Flag */
 #define X86_EFLAGS_AF  0x00000010 /* Auxillary carry Flag */
 #define X86_EFLAGS_ZF  0x00000040 /* Zero Flag */