Changeset 77325 in vbox
- Timestamp:
- Feb 15, 2019 7:55:09 AM (6 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/HMVMXAll.cpp
r76993 r77325 672 672 * In V86 mode (VT-x or not), the CPU enforces real-mode compatible selector 673 673 * bases, limits, and attributes, i.e. limit must be 64K, base must be selector * 16, 674 * and attr ributes must be 0x9b for code and 0x93 for code segments.674 * and attributes must be 0x9b for code and 0x93 for code segments. 675 675 * If this is not true, we cannot execute real mode as V86 and have to fall 676 676 * back to emulation. … … 717 717 if (pVCpu->hm.s.vmx.fWasInRealMode) 718 718 { 719 /** @todo If guest is in V86 mode, these checks should be different! */ 720 if ((pCtx->cs.Sel & X86_SEL_RPL) != (pCtx->ss.Sel & X86_SEL_RPL)) 719 if (!CPUMIsGuestInV86ModeEx(pCtx)) 721 720 { 722 STAM_COUNTER_INC(&pVCpu->hm.s.StatVmxCheckBadRpl); 723 return false; 721 /* The guest switched to protected mode, check if the state is suitable for VT-x. */ 722 if ((pCtx->cs.Sel & X86_SEL_RPL) != (pCtx->ss.Sel & X86_SEL_RPL)) 723 { 724 STAM_COUNTER_INC(&pVCpu->hm.s.StatVmxCheckBadRpl); 725 return false; 726 } 727 if ( !hmVmxIsCodeSelectorOk(&pCtx->cs, pCtx->ss.Attr.n.u2Dpl) 728 || !hmVmxIsDataSelectorOk(&pCtx->ds) 729 || !hmVmxIsDataSelectorOk(&pCtx->es) 730 || !hmVmxIsDataSelectorOk(&pCtx->fs) 731 || !hmVmxIsDataSelectorOk(&pCtx->gs) 732 || !hmVmxIsStackSelectorOk(&pCtx->ss)) 733 { 734 STAM_COUNTER_INC(&pVCpu->hm.s.StatVmxCheckBadSel); 735 return false; 736 } 724 737 } 725 if ( !hmVmxIsCodeSelectorOk(&pCtx->cs, pCtx->ss.Attr.n.u2Dpl) 726 || !hmVmxIsDataSelectorOk(&pCtx->ds) 727 || !hmVmxIsDataSelectorOk(&pCtx->es) 728 || !hmVmxIsDataSelectorOk(&pCtx->fs) 729 || !hmVmxIsDataSelectorOk(&pCtx->gs) 730 || !hmVmxIsStackSelectorOk(&pCtx->ss)) 738 else 731 739 { 732 STAM_COUNTER_INC(&pVCpu->hm.s.StatVmxCheckBadSel); 733 return false; 740 /* The guest switched to V86 mode, check if the state is suitable for VT-x. */ 741 if ( pCtx->cs.Sel != (pCtx->cs.u64Base >> 4) 742 || pCtx->ds.Sel != (pCtx->ds.u64Base >> 4) 743 || pCtx->es.Sel != (pCtx->es.u64Base >> 4) 744 || pCtx->ss.Sel != (pCtx->ss.u64Base >> 4) 745 || pCtx->fs.Sel != (pCtx->fs.u64Base >> 4) 746 || pCtx->gs.Sel != (pCtx->gs.u64Base >> 4)) 747 { 748 STAM_COUNTER_INC(&pVCpu->hm.s.StatVmxCheckBadV86SelBase); 749 return false; 750 } 751 if ( (pCtx->cs.u32Limit != 0xffff) 752 || (pCtx->ds.u32Limit != 0xffff) 753 || (pCtx->es.u32Limit != 0xffff) 754 || (pCtx->ss.u32Limit != 0xffff) 755 || (pCtx->fs.u32Limit != 0xffff) 756 || (pCtx->gs.u32Limit != 0xffff)) 757 { 758 STAM_COUNTER_INC(&pVCpu->hm.s.StatVmxCheckBadV86SelLimit); 759 return false; 760 } 761 if ( (pCtx->cs.Attr.u != 0xf3) 762 || (pCtx->ds.Attr.u != 0xf3) 763 || (pCtx->es.Attr.u != 0xf3) 764 || (pCtx->ss.Attr.u != 0xf3) 765 || (pCtx->fs.Attr.u != 0xf3) 766 || (pCtx->gs.Attr.u != 0xf3)) 767 { 768 STAM_COUNTER_INC(&pVCpu->hm.s.StatVmxCheckBadV86SelAttr); 769 return false; 770 } 734 771 } 735 772 } … … 738 775 else 739 776 { 740 if ( !CPUMIsGuestInLongModeEx(pCtx) 741 && !pVM->hm.s.vmx.fUnrestrictedGuest) 777 if (!CPUMIsGuestInLongModeEx(pCtx)) 742 778 { 743 779 if ( !pVM->hm.s.fNestedPaging /* Requires a fake PD for real *and* protected mode without paging - stored in the VMM device heap */ -
trunk/src/VBox/VMM/VMMR3/HM.cpp
r76993 r77325 823 823 HM_REG_COUNTER(&pVCpu->hm.s.StatVmxCheckBadRmSelBase, "/HM/CPU%d/VMXCheck/RMSelBase", "Could not use VMX due to unsuitable real-mode selector base."); 824 824 HM_REG_COUNTER(&pVCpu->hm.s.StatVmxCheckBadRmSelLimit, "/HM/CPU%d/VMXCheck/RMSelLimit", "Could not use VMX due to unsuitable real-mode selector limit."); 825 HM_REG_COUNTER(&pVCpu->hm.s.StatVmxCheckBadRmSelAttr, "/HM/CPU%d/VMXCheck/RMSelAttrs", "Could not use VMX due to unsuitable real-mode selector limit."); 825 HM_REG_COUNTER(&pVCpu->hm.s.StatVmxCheckBadRmSelAttr, "/HM/CPU%d/VMXCheck/RMSelAttrs", "Could not use VMX due to unsuitable real-mode selector attributes."); 826 827 HM_REG_COUNTER(&pVCpu->hm.s.StatVmxCheckBadV86SelBase, "/HM/CPU%d/VMXCheck/V86SelBase", "Could not use VMX due to unsuitable v8086-mode selector base."); 828 HM_REG_COUNTER(&pVCpu->hm.s.StatVmxCheckBadV86SelLimit, "/HM/CPU%d/VMXCheck/V86SelLimit", "Could not use VMX due to unsuitable v8086-mode selector limit."); 829 HM_REG_COUNTER(&pVCpu->hm.s.StatVmxCheckBadV86SelAttr, "/HM/CPU%d/VMXCheck/V86SelAttrs", "Could not use VMX due to unsuitable v8086-mode selector attributes."); 830 826 831 HM_REG_COUNTER(&pVCpu->hm.s.StatVmxCheckRmOk, "/HM/CPU%d/VMXCheck/VMX_RM", "VMX execution in real (V86) mode OK."); 827 832 HM_REG_COUNTER(&pVCpu->hm.s.StatVmxCheckBadSel, "/HM/CPU%d/VMXCheck/Selector", "Could not use VMX due to unsuitable selector."); -
trunk/src/VBox/VMM/include/HMInternal.h
r77280 r77325 1068 1068 STAMCOUNTER StatVmxCheckBadRmSelLimit; 1069 1069 STAMCOUNTER StatVmxCheckBadRmSelAttr; 1070 STAMCOUNTER StatVmxCheckBadV86SelBase; 1071 STAMCOUNTER StatVmxCheckBadV86SelLimit; 1072 STAMCOUNTER StatVmxCheckBadV86SelAttr; 1070 1073 STAMCOUNTER StatVmxCheckRmOk; 1071 1074 STAMCOUNTER StatVmxCheckBadSel;
Note:
See TracChangeset
for help on using the changeset viewer.