Changeset 87547 in vbox for trunk/src/VBox/VMM/VMMR0
- Timestamp:
- Feb 2, 2021 5:33:49 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 142573
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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)
Note:
See TracChangeset
for help on using the changeset viewer.