Changeset 87547 in vbox
- Timestamp:
- Feb 2, 2021 5:33:49 PM (4 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/HMAll.cpp
r87543 r87547 648 648 return HMIsEnabled(pVM) 649 649 && CTX_EXPR(pVM->hm.s.fNestedPagingCfg, pVM->hmr0.s.fNestedPaging, RT_NOTHING) 650 && ( pVM->hm.s.vmx.fUnrestrictedGuest650 && ( CTX_EXPR(pVM->hm.s.vmx.fUnrestrictedGuestCfg, pVM->hmr0.s.vmx.fUnrestrictedGuest, RT_NOTHING) 651 651 || pVM->hm.s.svm.fSupported); 652 652 } -
trunk/src/VBox/VMM/VMMAll/HMVMXAll.cpp
r87543 r87547 605 605 { 606 606 Assert(HMIsEnabled(pVM)); 607 Assert( ( pVM->hm.s.vmx.fUnrestrictedGuest && !pVM->hm.s.vmx.pRealModeTSS) 608 || (!pVM->hm.s.vmx.fUnrestrictedGuest && pVM->hm.s.vmx.pRealModeTSS)); 607 bool const fUnrestrictedGuest = CTX_EXPR(pVM->hm.s.vmx.fUnrestrictedGuestCfg, pVM->hmr0.s.vmx.fUnrestrictedGuest, RT_NOTHING); 608 Assert( ( fUnrestrictedGuest && !pVM->hm.s.vmx.pRealModeTSS) 609 || (!fUnrestrictedGuest && pVM->hm.s.vmx.pRealModeTSS)); 609 610 610 611 pVCpu->hm.s.fActive = false; 611 612 612 bool const fSupportsRealMode = pVM->hm.s.vmx.fUnrestrictedGuest || PDMVmmDevHeapIsEnabled(pVM);613 if (! pVM->hm.s.vmx.fUnrestrictedGuest)613 bool const fSupportsRealMode = fUnrestrictedGuest || PDMVmmDevHeapIsEnabled(pVM); 614 if (!fUnrestrictedGuest) 614 615 { 615 616 /* -
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r87546 r87547 3879 3879 3880 3880 /* Enable unrestricted guest execution. */ 3881 if (pVM->hm .s.vmx.fUnrestrictedGuest)3881 if (pVM->hmr0.s.vmx.fUnrestrictedGuest) 3882 3882 fVal |= VMX_PROC_CTLS2_UNRESTRICTED_GUEST; 3883 3883 … … 3971 3971 if (!pVM->hmr0.s.fNestedPaging) 3972 3972 { 3973 Assert(!pVM->hm .s.vmx.fUnrestrictedGuest);3973 Assert(!pVM->hmr0.s.vmx.fUnrestrictedGuest); 3974 3974 fVal |= VMX_PROC_CTLS_INVLPG_EXIT 3975 3975 | VMX_PROC_CTLS_CR3_LOAD_EXIT … … 4029 4029 4030 4030 /* Sanity check, should not really happen. */ 4031 if (RT_LIKELY(!pVM->hm .s.vmx.fUnrestrictedGuest))4031 if (RT_LIKELY(!pVM->hmr0.s.vmx.fUnrestrictedGuest)) 4032 4032 { /* likely */ } 4033 4033 else … … 4512 4512 4513 4513 /* 4514 * Without unrestricted guest execution, pRealModeTSS and pNonPagingModeEPTPageTable *must*4515 * always be allocated. We no longer support the highly unlikely case of unrestricted guest4516 * without pRealModeTSS, see hmR3InitFinalizeR0Intel().4517 */4518 if ( !pVM->hm.s.vmx.fUnrestrictedGuest4519 && ( !pVM->hm.s.vmx.pNonPagingModeEPTPageTable4520 || !pVM->hm.s.vmx.pRealModeTSS))4521 {4522 LogRelFunc(("Invalid real-on-v86 state.\n"));4523 return VERR_INTERNAL_ERROR;4524 }4525 4526 /*4527 4514 * Check that nested paging is supported if enabled and copy over the flag to the 4528 4515 * ring-0 only structure. … … 4534 4521 pVM->hmr0.s.fNestedPaging = fNestedPaging; 4535 4522 pVM->hmr0.s.fAllow64BitGuests = pVM->hm.s.fAllow64BitGuestsCfg; 4523 4524 /* 4525 * Without unrestricted guest execution, pRealModeTSS and pNonPagingModeEPTPageTable *must* 4526 * always be allocated. We no longer support the highly unlikely case of unrestricted guest 4527 * without pRealModeTSS, see hmR3InitFinalizeR0Intel(). 4528 */ 4529 bool const fUnrestrictedGuest = pVM->hm.s.vmx.fUnrestrictedGuestCfg; 4530 AssertReturn( !fUnrestrictedGuest 4531 || ( (g_HmMsrs.u.vmx.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_UNRESTRICTED_GUEST) 4532 && fNestedPaging), 4533 VERR_INCOMPATIBLE_CONFIG); 4534 if ( !fUnrestrictedGuest 4535 && ( !pVM->hm.s.vmx.pNonPagingModeEPTPageTable 4536 || !pVM->hm.s.vmx.pRealModeTSS)) 4537 { 4538 LogRelFunc(("Invalid real-on-v86 state.\n")); 4539 return VERR_INTERNAL_ERROR; 4540 } 4541 pVM->hmr0.s.vmx.fUnrestrictedGuest = fUnrestrictedGuest; 4536 4542 4537 4543 /* Initialize these always, see hmR3InitFinalizeR0().*/ … … 5652 5658 uint64_t fSetCr0 = g_HmMsrs.u.vmx.u64Cr0Fixed0; 5653 5659 uint64_t const fZapCr0 = g_HmMsrs.u.vmx.u64Cr0Fixed1; 5654 if (pVM->hm .s.vmx.fUnrestrictedGuest)5660 if (pVM->hmr0.s.vmx.fUnrestrictedGuest) 5655 5661 fSetCr0 &= ~(uint64_t)(X86_CR0_PE | X86_CR0_PG); 5656 5662 else … … 5684 5690 5685 5691 /* If we have unrestricted guest execution, we never have to intercept CR3 reads. */ 5686 if (pVM->hm .s.vmx.fUnrestrictedGuest)5692 if (pVM->hmr0.s.vmx.fUnrestrictedGuest) 5687 5693 uProcCtls &= ~VMX_PROC_CTLS_CR3_STORE_EXIT; 5688 5694 } … … 5863 5869 uint64_t u64GuestCr3; 5864 5870 PCCPUMCTX pCtx = &pVCpu->cpum.GstCtx; 5865 if ( pVM->hm .s.vmx.fUnrestrictedGuest5871 if ( pVM->hmr0.s.vmx.fUnrestrictedGuest 5866 5872 || CPUMIsGuestPagingEnabledEx(pCtx)) 5867 5873 { … … 5973 5979 { 5974 5980 if ( !CPUMIsGuestPagingEnabledEx(pCtx) 5975 && !pVM->hm .s.vmx.fUnrestrictedGuest)5981 && !pVM->hmr0.s.vmx.fUnrestrictedGuest) 5976 5982 { 5977 5983 /* We use 4 MB pages in our identity mapping page table when the guest doesn't have paging. */ … … 6235 6241 PCCPUMCTX pCtx = &pVCpu->cpum.GstCtx; 6236 6242 hmR0VmxImportGuestState(pVCpu, pVmcsInfo, CPUMCTX_EXTRN_CR0); 6237 if ( !pVM->hm .s.vmx.fUnrestrictedGuest6243 if ( !pVM->hmr0.s.vmx.fUnrestrictedGuest 6238 6244 && ( !CPUMIsGuestInRealModeEx(pCtx) 6239 6245 && !CPUMIsGuestInV86ModeEx(pCtx))) … … 6341 6347 else if ( CPUMIsGuestInV86ModeEx(pCtx) 6342 6348 || ( CPUMIsGuestInRealModeEx(pCtx) 6343 && !pVM->hm .s.vmx.fUnrestrictedGuest))6349 && !pVM->hmr0.s.vmx.fUnrestrictedGuest)) 6344 6350 { 6345 6351 /* Real and v86 mode checks. */ … … 6782 6788 */ 6783 6789 uint64_t uGuestEferMsr = pCtx->msrEFER; 6784 if (!pVM->hm .s.vmx.fUnrestrictedGuest)6790 if (!pVM->hmr0.s.vmx.fUnrestrictedGuest) 6785 6791 { 6786 6792 if (!(pCtx->msrEFER & MSR_K6_EFER_LMA)) … … 7885 7891 { 7886 7892 /* CR0.PG bit changes are always intercepted, so it's up to date. */ 7887 if ( pVM->hm .s.vmx.fUnrestrictedGuest7893 if ( pVM->hmr0.s.vmx.fUnrestrictedGuest 7888 7894 || ( pVM->hmr0.s.fNestedPaging 7889 7895 && CPUMIsGuestPagingEnabledEx(pCtx))) … … 8798 8804 if (CPUMIsGuestInRealModeEx(pCtx)) /* CR0.PE bit changes are always intercepted, so it's up to date. */ 8799 8805 { 8800 if (pVCpu->CTX_SUFF(pVM)->hm .s.vmx.fUnrestrictedGuest)8806 if (pVCpu->CTX_SUFF(pVM)->hmr0.s.vmx.fUnrestrictedGuest) 8801 8807 { 8802 8808 /* … … 9485 9491 */ 9486 9492 PVMXVMCSINFOSHARED pVmcsInfoShared = pVmxTransient->pVmcsInfo->pShared; 9487 if ( pVCpu->CTX_SUFF(pVM)->hm .s.vmx.fUnrestrictedGuest9493 if ( pVCpu->CTX_SUFF(pVM)->hmr0.s.vmx.fUnrestrictedGuest 9488 9494 || !CPUMIsGuestInRealModeEx(&pVCpu->cpum.GstCtx)) 9489 9495 pVmcsInfoShared->RealMode.fRealOnV86Active = false; … … 9677 9683 uint32_t uError = VMX_IGS_ERROR; 9678 9684 uint32_t u32IntrState = 0; 9679 bool const fUnrestrictedGuest = pVM->hm .s.vmx.fUnrestrictedGuest;9685 bool const fUnrestrictedGuest = pVM->hmr0.s.vmx.fUnrestrictedGuest; 9680 9686 do 9681 9687 { … … 9887 9893 else if (pCtx->cs.Attr.n.u4Type == 13 || pCtx->cs.Attr.n.u4Type == 15) 9888 9894 HMVMX_CHECK_BREAK(pCtx->cs.Attr.n.u2Dpl <= pCtx->ss.Attr.n.u2Dpl, VMX_IGS_CS_SS_ATTR_DPL_MISMATCH); 9889 else if ( pVM->hm.s.vmx.fUnrestrictedGuest && pCtx->cs.Attr.n.u4Type == 3)9895 else if (fUnrestrictedGuest && pCtx->cs.Attr.n.u4Type == 3) 9890 9896 HMVMX_CHECK_BREAK(pCtx->cs.Attr.n.u2Dpl == 0, VMX_IGS_CS_ATTR_DPL_INVALID); 9891 9897 else … … 9893 9899 9894 9900 /* SS */ 9895 HMVMX_CHECK_BREAK( pVM->hm.s.vmx.fUnrestrictedGuest9901 HMVMX_CHECK_BREAK( fUnrestrictedGuest 9896 9902 || (pCtx->ss.Sel & X86_SEL_RPL) == (pCtx->cs.Sel & X86_SEL_RPL), VMX_IGS_SS_CS_RPL_UNEQUAL); 9897 9903 HMVMX_CHECK_BREAK(pCtx->ss.Attr.n.u2Dpl == (pCtx->ss.Sel & X86_SEL_RPL), VMX_IGS_SS_ATTR_DPL_RPL_UNEQUAL); … … 9917 9923 HMVMX_CHECK_BREAK(pCtx->ds.Attr.n.u4Type & X86_SEL_TYPE_ACCESSED, VMX_IGS_DS_ATTR_A_INVALID); 9918 9924 HMVMX_CHECK_BREAK(pCtx->ds.Attr.n.u1Present, VMX_IGS_DS_ATTR_P_INVALID); 9919 HMVMX_CHECK_BREAK( pVM->hm.s.vmx.fUnrestrictedGuest9925 HMVMX_CHECK_BREAK( fUnrestrictedGuest 9920 9926 || pCtx->ds.Attr.n.u4Type > 11 9921 9927 || pCtx->ds.Attr.n.u2Dpl >= (pCtx->ds.Sel & X86_SEL_RPL), VMX_IGS_DS_ATTR_DPL_RPL_UNEQUAL); … … 9933 9939 HMVMX_CHECK_BREAK(pCtx->es.Attr.n.u4Type & X86_SEL_TYPE_ACCESSED, VMX_IGS_ES_ATTR_A_INVALID); 9934 9940 HMVMX_CHECK_BREAK(pCtx->es.Attr.n.u1Present, VMX_IGS_ES_ATTR_P_INVALID); 9935 HMVMX_CHECK_BREAK( pVM->hm.s.vmx.fUnrestrictedGuest9941 HMVMX_CHECK_BREAK( fUnrestrictedGuest 9936 9942 || pCtx->es.Attr.n.u4Type > 11 9937 9943 || pCtx->es.Attr.n.u2Dpl >= (pCtx->es.Sel & X86_SEL_RPL), VMX_IGS_DS_ATTR_DPL_RPL_UNEQUAL); … … 9949 9955 HMVMX_CHECK_BREAK(pCtx->fs.Attr.n.u4Type & X86_SEL_TYPE_ACCESSED, VMX_IGS_FS_ATTR_A_INVALID); 9950 9956 HMVMX_CHECK_BREAK(pCtx->fs.Attr.n.u1Present, VMX_IGS_FS_ATTR_P_INVALID); 9951 HMVMX_CHECK_BREAK( pVM->hm.s.vmx.fUnrestrictedGuest9957 HMVMX_CHECK_BREAK( fUnrestrictedGuest 9952 9958 || pCtx->fs.Attr.n.u4Type > 11 9953 9959 || pCtx->fs.Attr.n.u2Dpl >= (pCtx->fs.Sel & X86_SEL_RPL), VMX_IGS_FS_ATTR_DPL_RPL_UNEQUAL); … … 9965 9971 HMVMX_CHECK_BREAK(pCtx->gs.Attr.n.u4Type & X86_SEL_TYPE_ACCESSED, VMX_IGS_GS_ATTR_A_INVALID); 9966 9972 HMVMX_CHECK_BREAK(pCtx->gs.Attr.n.u1Present, VMX_IGS_GS_ATTR_P_INVALID); 9967 HMVMX_CHECK_BREAK( pVM->hm.s.vmx.fUnrestrictedGuest9973 HMVMX_CHECK_BREAK( fUnrestrictedGuest 9968 9974 || pCtx->gs.Attr.n.u4Type > 11 9969 9975 || pCtx->gs.Attr.n.u2Dpl >= (pCtx->gs.Sel & X86_SEL_RPL), VMX_IGS_GS_ATTR_DPL_RPL_UNEQUAL); … … 10599 10605 */ 10600 10606 PVMXVMCSINFO pVmcsInfoNstGst = &pVCpu->hmr0.s.vmx.VmcsInfoNstGst; 10601 Assert(pVM->hm .s.vmx.fUnrestrictedGuest);10607 Assert(pVM->hmr0.s.vmx.fUnrestrictedGuest); 10602 10608 Assert(g_HmMsrs.u.vmx.ProcCtls.n.allowed1 & VMX_PROC_CTLS_USE_SECONDARY_CTLS); 10603 10609 Assert(hmGetVmxActiveVmcsInfo(pVCpu) == pVmcsInfoNstGst); … … 14312 14318 14313 14319 Assert(CPUMIsGuestInRealModeEx(pCtx)); 14314 Assert(!pVCpu->CTX_SUFF(pVM)->hm .s.vmx.fUnrestrictedGuest);14320 Assert(!pVCpu->CTX_SUFF(pVM)->hmr0.s.vmx.fUnrestrictedGuest); 14315 14321 Assert(!pVmxTransient->fIsNestedGuest); 14316 14322 … … 15525 15531 if ( iCrReg == 0 15526 15532 && rcStrict == VINF_SUCCESS 15527 && !pVM->hm .s.vmx.fUnrestrictedGuest15533 && !pVM->hmr0.s.vmx.fUnrestrictedGuest 15528 15534 && CPUMIsGuestInRealModeEx(&pVCpu->cpum.GstCtx) 15529 15535 && (uOldCr0 & X86_CR0_PE) -
trunk/src/VBox/VMM/VMMR3/HM.cpp
r87546 r87547 578 578 if ( fAllowUnrestricted 579 579 && (fCaps & SUPVTCAPS_VTX_UNRESTRICTED_GUEST)) 580 pVM->hm.s.vmx.fUnrestrictedGuest = true;580 pVM->hm.s.vmx.fUnrestrictedGuestCfg = true; 581 581 else 582 Assert(!pVM->hm.s.vmx.fUnrestrictedGuest );582 Assert(!pVM->hm.s.vmx.fUnrestrictedGuestCfg); 583 583 } 584 584 } … … 1566 1566 || (pVM->hm.s.vmx.MsrsForRing3.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_EPT), 1567 1567 VERR_HM_IPE_1); 1568 AssertLogRelReturn( !pVM->hm.s.vmx.fUnrestrictedGuest 1568 AssertLogRelReturn( !pVM->hm.s.vmx.fUnrestrictedGuestCfg 1569 1569 || ( (pVM->hm.s.vmx.MsrsForRing3.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_UNRESTRICTED_GUEST) 1570 1570 && pVM->hm.s.fNestedPagingCfg), … … 1583 1583 } 1584 1584 1585 if (!pVM->hm.s.vmx.fUnrestrictedGuest )1585 if (!pVM->hm.s.vmx.fUnrestrictedGuestCfg) 1586 1586 { 1587 1587 /* Allocate three pages for the TSS we need for real mode emulation. (2 pages for the IO bitmap) */ … … 1706 1706 LogRel(("HM: EPT flush type = %#x\n", pVM->hm.s.vmx.enmTlbFlushEptForRing3)); 1707 1707 1708 if (pVM->hm.s.vmx.fUnrestrictedGuest )1708 if (pVM->hm.s.vmx.fUnrestrictedGuestCfg) 1709 1709 LogRel(("HM: Enabled unrestricted guest execution\n")); 1710 1710 … … 1717 1717 } 1718 1718 else 1719 Assert(!pVM->hm.s.vmx.fUnrestrictedGuest );1719 Assert(!pVM->hm.s.vmx.fUnrestrictedGuestCfg); 1720 1720 1721 1721 if (pVM->hm.s.vmx.fVpidForRing3) … … 2638 2638 */ 2639 2639 if ( pVM->hm.s.vmx.fEnabled 2640 && !pVM->hm.s.vmx.fUnrestrictedGuest 2640 && !pVM->hm.s.vmx.fUnrestrictedGuestCfg 2641 2641 && CPUMIsGuestInRealModeEx(pCtx) 2642 2642 && !PDMVmmDevHeapIsEnabled(pVM)) … … 2852 2852 PVM pVM = pUVM->pVM; 2853 2853 VM_ASSERT_VALID_EXT_RETURN(pVM, false); 2854 return pVM->hm.s.vmx.fUnrestrictedGuest 2854 return pVM->hm.s.vmx.fUnrestrictedGuestCfg 2855 2855 || pVM->hm.s.svm.fSupported; 2856 2856 } -
trunk/src/VBox/VMM/include/HMInternal.h
r87546 r87547 487 487 struct 488 488 { 489 /** Set by the ring-0 side of HM to indicate VMX is supported by the 490 * CPU. */ 489 /** Set by the ring-0 side of HM to indicate VMX is supported by the CPU. */ 491 490 bool fSupported; 492 491 /** Set when we've enabled VMX. */ … … 498 497 /** Set if unrestricted guest execution is in use (real and protected mode 499 498 * without paging). */ 500 bool fUnrestrictedGuest ;499 bool fUnrestrictedGuestCfg; 501 500 /** Set if the preemption timer is in use or not. */ 502 501 bool fUsePreemptTimer; … … 644 643 struct HMR0VMXVM 645 644 { 645 /** Set if unrestricted guest execution is in use (real and protected mode 646 * without paging). */ 647 bool fUnrestrictedGuest; 648 bool afAlignment1[2]; 646 649 /** Set if VPID is supported (copy in HM::vmx::fVpidForRing3). */ 647 650 bool fVpid; 648 bool afAlignment1[3];649 650 651 /** Tagged-TLB flush type. */ 651 652 VMXTLBFLUSHTYPE enmTlbFlushType;
Note:
See TracChangeset
for help on using the changeset viewer.