Changeset 47770 in vbox
- Timestamp:
- Aug 15, 2013 2:16:59 PM (11 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r47766 r47770 174 174 { 175 175 /** The host's rflags/eflags. */ 176 RTCCUINTREG uE Flags;176 RTCCUINTREG uEflags; 177 177 #if HC_ARCH_BITS == 32 178 178 uint32_t u32Alignment0; … … 2882 2882 Let us assert it as such and use 32-bit VMWRITE. */ 2883 2883 Assert(!(pMixedCtx->rflags.u64 >> 32)); 2884 X86EFLAGS uEFlags = pMixedCtx->eflags;2885 uEFlags.u32 &= VMX_EFLAGS_RESERVED_0; /* Bits 22-31, 15, 5 & 3 MBZ. */2886 uEFlags.u32 |= VMX_EFLAGS_RESERVED_1; /* Bit 1 MB1. */2884 X86EFLAGS Eflags = pMixedCtx->eflags; 2885 Eflags.u32 &= VMX_EFLAGS_RESERVED_0; /* Bits 22-31, 15, 5 & 3 MBZ. */ 2886 Eflags.u32 |= VMX_EFLAGS_RESERVED_1; /* Bit 1 MB1. */ 2887 2887 2888 2888 /* … … 2894 2894 Assert(pVCpu->CTX_SUFF(pVM)->hm.s.vmx.pRealModeTSS); 2895 2895 Assert(PDMVmmDevHeapIsEnabled(pVCpu->CTX_SUFF(pVM))); 2896 pVCpu->hm.s.vmx.RealMode. eflags.u32 = uEFlags.u32;/* Save the original eflags of the real-mode guest. */2897 uEFlags.Bits.u1VM = 1;/* Set the Virtual 8086 mode bit. */2898 uEFlags.Bits.u2IOPL = 0;/* Change IOPL to 0, otherwise certain instructions won't fault. */2899 } 2900 2901 rc = VMXWriteVmcs32(VMX_VMCS_GUEST_RFLAGS, uEFlags.u32);2896 pVCpu->hm.s.vmx.RealMode.Eflags.u32 = Eflags.u32; /* Save the original eflags of the real-mode guest. */ 2897 Eflags.Bits.u1VM = 1; /* Set the Virtual 8086 mode bit. */ 2898 Eflags.Bits.u2IOPL = 0; /* Change IOPL to 0, otherwise certain instructions won't fault. */ 2899 } 2900 2901 rc = VMXWriteVmcs32(VMX_VMCS_GUEST_RFLAGS, Eflags.u32); 2902 2902 AssertRCReturn(rc, rc); 2903 2903 2904 Log4(("Load: VMX_VMCS_GUEST_RFLAGS=%#RX32\n", uEFlags.u32));2904 Log4(("Load: VMX_VMCS_GUEST_RFLAGS=%#RX32\n", Eflags.u32)); 2905 2905 pVCpu->hm.s.fContextUseFlags &= ~HM_CHANGED_GUEST_RFLAGS; 2906 2906 } … … 3675 3675 if (pVCpu->hm.s.vmx.RealMode.fRealOnV86Active) 3676 3676 { 3677 pVCpu->hm.s.vmx.RealMode. uAttrCS.u = pMixedCtx->cs.Attr.u;3678 pVCpu->hm.s.vmx.RealMode. uAttrSS.u = pMixedCtx->ss.Attr.u;3679 pVCpu->hm.s.vmx.RealMode. uAttrDS.u = pMixedCtx->ds.Attr.u;3680 pVCpu->hm.s.vmx.RealMode. uAttrES.u = pMixedCtx->es.Attr.u;3681 pVCpu->hm.s.vmx.RealMode. uAttrFS.u = pMixedCtx->fs.Attr.u;3682 pVCpu->hm.s.vmx.RealMode. uAttrGS.u = pMixedCtx->gs.Attr.u;3677 pVCpu->hm.s.vmx.RealMode.AttrCS.u = pMixedCtx->cs.Attr.u; 3678 pVCpu->hm.s.vmx.RealMode.AttrSS.u = pMixedCtx->ss.Attr.u; 3679 pVCpu->hm.s.vmx.RealMode.AttrDS.u = pMixedCtx->ds.Attr.u; 3680 pVCpu->hm.s.vmx.RealMode.AttrES.u = pMixedCtx->es.Attr.u; 3681 pVCpu->hm.s.vmx.RealMode.AttrFS.u = pMixedCtx->fs.Attr.u; 3682 pVCpu->hm.s.vmx.RealMode.AttrGS.u = pMixedCtx->gs.Attr.u; 3683 3683 } 3684 3684 … … 4321 4321 PHMGLOBLCPUINFO pCpu; 4322 4322 RTHCPHYS HCPhysCpuPage; 4323 RTCCUINTREG uOldE Flags;4323 RTCCUINTREG uOldEflags; 4324 4324 4325 4325 AssertReturn(pVM->hm.s.pfnHost32ToGuest64R0, VERR_HM_NO_32_TO_64_SWITCHER); … … 4337 4337 4338 4338 /* Disable interrupts. */ 4339 uOldE Flags = ASMIntDisableFlags();4339 uOldEflags = ASMIntDisableFlags(); 4340 4340 4341 4341 #ifdef VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI … … 4375 4375 { 4376 4376 ASMSetCR4(ASMGetCR4() & ~X86_CR4_VMXE); 4377 ASMSetFlags(uOldE Flags);4377 ASMSetFlags(uOldEflags); 4378 4378 return rc2; 4379 4379 } … … 4382 4382 AssertRC(rc2); 4383 4383 Assert(!(ASMGetFlags() & X86_EFL_IF)); 4384 ASMSetFlags(uOldE Flags);4384 ASMSetFlags(uOldEflags); 4385 4385 return rc; 4386 4386 } … … 5154 5154 5155 5155 pMixedCtx->eflags.Bits.u1VM = 0; 5156 pMixedCtx->eflags.Bits.u2IOPL = pVCpu->hm.s.vmx.RealMode. eflags.Bits.u2IOPL;5156 pMixedCtx->eflags.Bits.u2IOPL = pVCpu->hm.s.vmx.RealMode.Eflags.Bits.u2IOPL; 5157 5157 } 5158 5158 … … 5579 5579 if (pVCpu->hm.s.vmx.RealMode.fRealOnV86Active) 5580 5580 { 5581 pMixedCtx->cs.Attr.u = pVCpu->hm.s.vmx.RealMode. uAttrCS.u;5582 pMixedCtx->ss.Attr.u = pVCpu->hm.s.vmx.RealMode. uAttrSS.u;5583 pMixedCtx->ds.Attr.u = pVCpu->hm.s.vmx.RealMode. uAttrDS.u;5584 pMixedCtx->es.Attr.u = pVCpu->hm.s.vmx.RealMode. uAttrES.u;5585 pMixedCtx->fs.Attr.u = pVCpu->hm.s.vmx.RealMode. uAttrFS.u;5586 pMixedCtx->gs.Attr.u = pVCpu->hm.s.vmx.RealMode. uAttrGS.u;5581 pMixedCtx->cs.Attr.u = pVCpu->hm.s.vmx.RealMode.AttrCS.u; 5582 pMixedCtx->ss.Attr.u = pVCpu->hm.s.vmx.RealMode.AttrSS.u; 5583 pMixedCtx->ds.Attr.u = pVCpu->hm.s.vmx.RealMode.AttrDS.u; 5584 pMixedCtx->es.Attr.u = pVCpu->hm.s.vmx.RealMode.AttrES.u; 5585 pMixedCtx->fs.Attr.u = pVCpu->hm.s.vmx.RealMode.AttrFS.u; 5586 pMixedCtx->gs.Attr.u = pVCpu->hm.s.vmx.RealMode.AttrGS.u; 5587 5587 } 5588 5588 pVCpu->hm.s.vmx.fUpdatedGuestState |= HMVMX_UPDATED_GUEST_SEGMENT_REGS; … … 7119 7119 #ifdef VBOX_WITH_VMMR0_DISABLE_PREEMPTION 7120 7120 /* We disable interrupts so that we don't miss any interrupts that would flag preemption (IPI/timers etc.) */ 7121 pVmxTransient->uE Flags = ASMIntDisableFlags();7121 pVmxTransient->uEflags = ASMIntDisableFlags(); 7122 7122 if (RTThreadPreemptIsPending(NIL_RTTHREAD)) 7123 7123 { 7124 ASMSetFlags(pVmxTransient->uE Flags);7124 ASMSetFlags(pVmxTransient->uEflags); 7125 7125 STAM_COUNTER_INC(&pVCpu->hm.s.StatPendingHostIrq); 7126 7126 /* Don't use VINF_EM_RAW_INTERRUPT_HYPER as we can't assume the host does kernel preemption. Maybe some day? */ … … 7170 7170 #ifndef VBOX_WITH_VMMR0_DISABLE_PREEMPTION 7171 7171 /** @todo I don't see the point of this, VMMR0EntryFast() already disables interrupts for the entire period. */ 7172 pVmxTransient->uE Flags = ASMIntDisableFlags();7172 pVmxTransient->uEflags = ASMIntDisableFlags(); 7173 7173 VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED_EXEC); 7174 7174 #endif … … 7281 7281 VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED_HM); 7282 7282 7283 ASMSetFlags(pVmxTransient->uE Flags); /* Enable interrupts. */7283 ASMSetFlags(pVmxTransient->uEflags); /* Enable interrupts. */ 7284 7284 pVCpu->hm.s.fResumeVM = true; /* Use VMRESUME instead of VMLAUNCH in the next run. */ 7285 7285 … … 7756 7756 * RIP and RFLAGS. 7757 7757 */ 7758 uint32_t u32E Flags;7758 uint32_t u32Eflags; 7759 7759 #if HC_ARCH_BITS == 64 || defined(VBOX_WITH_HYBRID_32BIT_KERNEL) 7760 7760 if (HMVMX_IS_64BIT_HOST_MODE()) … … 7779 7779 VMX_IGS_RFLAGS_RESERVED); 7780 7780 HMVMX_CHECK_BREAK((u64Val & X86_EFL_RA1_MASK), VMX_IGS_RFLAGS_RESERVED1); /* Bit 1 MB1. */ 7781 u32E Flags = u64Val;7781 u32Eflags = u64Val; 7782 7782 } 7783 7783 else 7784 7784 #endif 7785 7785 { 7786 rc = VMXReadVmcs32(VMX_VMCS_GUEST_RFLAGS, &u32E Flags);7786 rc = VMXReadVmcs32(VMX_VMCS_GUEST_RFLAGS, &u32Eflags); 7787 7787 AssertRCBreak(rc); 7788 HMVMX_CHECK_BREAK(!(u32E Flags & 0xffc08028), VMX_IGS_RFLAGS_RESERVED); /* Bit 31:22, Bit 15, 5, 3 MBZ. */7789 HMVMX_CHECK_BREAK((u32E Flags & X86_EFL_RA1_MASK), VMX_IGS_RFLAGS_RESERVED1); /* Bit 1 MB1. */7788 HMVMX_CHECK_BREAK(!(u32Eflags & 0xffc08028), VMX_IGS_RFLAGS_RESERVED); /* Bit 31:22, Bit 15, 5, 3 MBZ. */ 7789 HMVMX_CHECK_BREAK((u32Eflags & X86_EFL_RA1_MASK), VMX_IGS_RFLAGS_RESERVED1); /* Bit 1 MB1. */ 7790 7790 } 7791 7791 … … 7793 7793 || !(pCtx->cr0 & X86_CR0_PE)) 7794 7794 { 7795 HMVMX_CHECK_BREAK(!(u32E Flags & X86_EFL_VM), VMX_IGS_RFLAGS_VM_INVALID);7795 HMVMX_CHECK_BREAK(!(u32Eflags & X86_EFL_VM), VMX_IGS_RFLAGS_VM_INVALID); 7796 7796 } 7797 7797 … … 7898 7898 HMVMX_CHECK_BREAK( (pCtx->ldtr.Attr.u & X86DESCATTR_UNUSABLE) 7899 7899 || !(pCtx->ldtr.Sel & X86_SEL_LDT), VMX_IGS_LDTR_TI_INVALID); 7900 if (!(u32E Flags & X86_EFL_VM))7900 if (!(u32Eflags & X86_EFL_VM)) 7901 7901 { 7902 7902 /* CS */ … … 8173 8173 | VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_MOVSS), 8174 8174 VMX_IGS_INTERRUPTIBILITY_STATE_STI_MOVSS_INVALID); 8175 HMVMX_CHECK_BREAK( (u32E Flags & X86_EFL_IF)8175 HMVMX_CHECK_BREAK( (u32Eflags & X86_EFL_IF) 8176 8176 || !(u32IntrState & VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_STI), 8177 8177 VMX_IGS_INTERRUPTIBILITY_STATE_STI_EFL_INVALID); … … 8227 8227 || u32ActivityState == VMX_VMCS_GUEST_ACTIVITY_HLT) 8228 8228 { 8229 if ( (u32E Flags & X86_EFL_TF)8229 if ( (u32Eflags & X86_EFL_TF) 8230 8230 && !(u64DebugCtlMsr & RT_BIT_64(1))) /* Bit 1 is IA32_DEBUGCTL.BTF. */ 8231 8231 { … … 8233 8233 HMVMX_CHECK_BREAK(u32Val & RT_BIT(14), VMX_IGS_PENDING_DEBUG_XCPT_BS_NOT_SET); 8234 8234 } 8235 if ( !(u32E Flags & X86_EFL_TF)8235 if ( !(u32Eflags & X86_EFL_TF) 8236 8236 || (u64DebugCtlMsr & RT_BIT_64(1))) /* Bit 1 is IA32_DEBUGCTL.BTF. */ 8237 8237 { … … 10080 10080 } 10081 10081 10082 /* Get the stack pointer & pop the contents of the stack onto E Flags. */10082 /* Get the stack pointer & pop the contents of the stack onto Eflags. */ 10083 10083 RTGCPTR GCPtrStack = 0; 10084 X86EFLAGS uEflags;10084 X86EFLAGS Eflags; 10085 10085 rc = SELMToFlatEx(pVCpu, DISSELREG_SS, CPUMCTX2CORE(pMixedCtx), pMixedCtx->esp & uMask, SELMTOFLAT_FLAGS_CPL0, 10086 10086 &GCPtrStack); 10087 10087 if (RT_SUCCESS(rc)) 10088 10088 { 10089 Assert(sizeof( uEflags.u32) >= cbParm);10090 uEflags.u32 = 0;10091 rc = PGMPhysRead(pVM, (RTGCPHYS)GCPtrStack, & uEflags.u32, cbParm);10089 Assert(sizeof(Eflags.u32) >= cbParm); 10090 Eflags.u32 = 0; 10091 rc = PGMPhysRead(pVM, (RTGCPHYS)GCPtrStack, &Eflags.u32, cbParm); 10092 10092 } 10093 10093 if (RT_FAILURE(rc)) … … 10096 10096 break; 10097 10097 } 10098 Log4(("POPF % x -> %#RX64 mask=%x RIP=%#RX64\n", uEflags.u, pMixedCtx->rsp, uMask, pMixedCtx->rip));10098 Log4(("POPF %#x -> %#RX64 mask=%#x RIP=%#RX64\n", Eflags.u, pMixedCtx->rsp, uMask, pMixedCtx->rip)); 10099 10099 pMixedCtx->eflags.u32 = (pMixedCtx->eflags.u32 & ~(X86_EFL_POPF_BITS & uMask)) 10100 | ( uEflags.u32 & X86_EFL_POPF_BITS & uMask);10100 | (Eflags.u32 & X86_EFL_POPF_BITS & uMask); 10101 10101 /* The RF bit is always cleared by POPF; see Intel Instruction reference for POPF. */ 10102 10102 pMixedCtx->eflags.Bits.u1RF = 0; … … 10133 10133 break; 10134 10134 } 10135 X86EFLAGS uEflags; 10136 uEflags = pMixedCtx->eflags; 10135 X86EFLAGS Eflags = pMixedCtx->eflags; 10137 10136 /* The RF & VM bits are cleared on image stored on stack; see Intel Instruction reference for PUSHF. */ 10138 uEflags.Bits.u1RF = 0;10139 uEflags.Bits.u1VM = 0;10140 10141 rc = PGMPhysWrite(pVM, (RTGCPHYS)GCPtrStack, & uEflags.u, cbParm);10137 Eflags.Bits.u1RF = 0; 10138 Eflags.Bits.u1VM = 0; 10139 10140 rc = PGMPhysWrite(pVM, (RTGCPHYS)GCPtrStack, &Eflags.u, cbParm); 10142 10141 if (RT_FAILURE(rc)) 10143 10142 { … … 10145 10144 break; 10146 10145 } 10147 Log4(("PUSHF % x -> %#RGv\n", uEflags.u, GCPtrStack));10146 Log4(("PUSHF %#x -> %#RGv\n", Eflags.u, GCPtrStack)); 10148 10147 pMixedCtx->esp -= cbParm; 10149 10148 pMixedCtx->esp &= uMask; -
trunk/src/VBox/VMM/include/HMInternal.h
r47766 r47770 631 631 struct 632 632 { 633 X86DESCATTR uAttrCS;634 X86DESCATTR uAttrDS;635 X86DESCATTR uAttrES;636 X86DESCATTR uAttrFS;637 X86DESCATTR uAttrGS;638 X86DESCATTR uAttrSS;639 X86EFLAGS eflags;633 X86DESCATTR AttrCS; 634 X86DESCATTR AttrDS; 635 X86DESCATTR AttrES; 636 X86DESCATTR AttrFS; 637 X86DESCATTR AttrGS; 638 X86DESCATTR AttrSS; 639 X86EFLAGS Eflags; 640 640 uint32_t fRealOnV86Active; 641 641 } RealMode; … … 649 649 RTCPUID idEnteredCpu; 650 650 RTCPUID idCurrentCpu; 651 uint32_t padding;651 uint32_t u32Padding; 652 652 } LastError; 653 653
Note:
See TracChangeset
for help on using the changeset viewer.