Changeset 81092 in vbox
- Timestamp:
- Oct 1, 2019 4:53:27 AM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 133698
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
r81002 r81092 2661 2661 PCSVMVMCBSTATESAVE pVmcbGuest = &pVmcb->guest; 2662 2662 PCSVMVMCBCTRL pVmcbCtrl = &pVmcb->ctrl; 2663 2664 Log4Func(("fExtrn=%#RX64 fWhat=%#RX64\n", pCtx->fExtrn, fWhat));2665 2663 2666 2664 /* … … 4100 4098 { 4101 4099 /* Pending PGM C3 sync. */ 4102 if (VMCPU_FF_IS_ANY_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL))4100 if (VMCPU_FF_IS_ANY_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL)) 4103 4101 { 4104 4102 int rc = PGMSyncCR3(pVCpu, pVCpu->cpum.GstCtx.cr0, pVCpu->cpum.GstCtx.cr3, pVCpu->cpum.GstCtx.cr4, … … 4183 4181 int rc = hmR0SvmCheckForceFlags(pVCpu); 4184 4182 if (rc != VINF_SUCCESS) 4183 { 4184 if (!CPUMIsGuestInSvmNestedHwVirtMode(pCtx)) 4185 STAM_COUNTER_INC(&pVCpu->hm.s.StatSwitchNstGstVmexit); 4185 4186 return rc; 4187 } 4186 4188 4187 4189 if (TRPMHasTrap(pVCpu)) … … 4192 4194 if ( rcStrict != VINF_SUCCESS 4193 4195 || !CPUMIsGuestInSvmNestedHwVirtMode(pCtx)) 4196 { 4197 if (!CPUMIsGuestInSvmNestedHwVirtMode(pCtx)) 4198 STAM_COUNTER_INC(&pVCpu->hm.s.StatSwitchNstGstVmexit); 4194 4199 return VBOXSTRICTRC_VAL(rcStrict); 4200 } 4195 4201 } 4196 4202 … … 4314 4320 4315 4321 #ifdef HMSVM_SYNC_FULL_GUEST_STATE 4316 Assert(!(pVCpu->cpum.GstCtx ->fExtrn & HMSVM_CPUMCTX_EXTRN_ALL));4322 Assert(!(pVCpu->cpum.GstCtx.fExtrn & HMSVM_CPUMCTX_EXTRN_ALL)); 4317 4323 ASMAtomicUoOrU64(&pVCpu->hm.s.fCtxChanged, HM_CHANGED_ALL_GUEST); 4318 4324 #endif … … 4922 4928 rc = hmR0SvmHandleExitNested(pVCpu, &SvmTransient); 4923 4929 STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatExitHandling, x); 4924 if ( rc != VINF_SUCCESS 4925 || !CPUMIsGuestInSvmNestedHwVirtMode(pCtx)) 4926 break; 4927 if (++(*pcLoops) >= pVCpu->CTX_SUFF(pVM)->hm.s.cMaxResumeLoops) 4928 { 4929 STAM_COUNTER_INC(&pVCpu->hm.s.StatSwitchMaxResumeLoops); 4930 rc = VINF_EM_RAW_INTERRUPT; 4931 break; 4932 } 4933 /** @todo NSTSVM: Add stat for StatSwitchNstGstVmexit. Re-arrange the above code to 4934 * be accurate when doing so, see the corresponding VT-x code. */ 4935 4936 /** @todo handle single-stepping */ 4930 if (rc == VINF_SUCCESS) 4931 { 4932 if (!CPUMIsGuestInSvmNestedHwVirtMode(pCtx)) 4933 { 4934 STAM_COUNTER_INC(&pVCpu->hm.s.StatSwitchNstGstVmexit); 4935 rc = VINF_SVM_VMEXIT; 4936 } 4937 else 4938 { 4939 if (++(*pcLoops) <= pVCpu->CTX_SUFF(pVM)->hm.s.cMaxResumeLoops) 4940 continue; 4941 STAM_COUNTER_INC(&pVCpu->hm.s.StatSwitchMaxResumeLoops); 4942 rc = VINF_EM_RAW_INTERRUPT; 4943 } 4944 } 4945 else 4946 Assert(rc != VINF_SVM_VMEXIT); 4947 break; 4948 /** @todo NSTSVM: handle single-stepping. */ 4937 4949 } 4938 4950 … … 4959 4971 uint32_t cLoops = 0; 4960 4972 int rc; 4973 for (;;) 4974 { 4961 4975 #ifdef VBOX_WITH_NESTED_HWVIRT_SVM 4962 if (!CPUMIsGuestInSvmNestedHwVirtMode(pCtx)) 4976 bool const fInNestedGuestMode = CPUMIsGuestInSvmNestedHwVirtMode(pCtx); 4977 #else 4978 NOREF(pCtx); 4979 bool const fInNestedGuestMode = false; 4963 4980 #endif 4964 { 4965 if (!pVCpu->hm.s.fSingleInstruction) 4966 rc = hmR0SvmRunGuestCodeNormal(pVCpu, &cLoops); 4981 if (!fInNestedGuestMode) 4982 { 4983 if (!pVCpu->hm.s.fSingleInstruction) 4984 rc = hmR0SvmRunGuestCodeNormal(pVCpu, &cLoops); 4985 else 4986 rc = hmR0SvmRunGuestCodeStep(pVCpu, &cLoops); 4987 } 4988 #ifdef VBOX_WITH_NESTED_HWVIRT_SVM 4967 4989 else 4968 rc = hmR0SvmRunGuestCodeStep(pVCpu, &cLoops); 4969 } 4970 #ifdef VBOX_WITH_NESTED_HWVIRT_SVM 4971 else 4972 { 4973 rc = VINF_SVM_VMRUN; 4974 } 4975 4976 /* Re-check the nested-guest condition here as we may be transitioning from the normal 4977 execution loop into the nested-guest, hence this is not placed in the 'else' part above. */ 4978 if (rc == VINF_SVM_VMRUN) 4979 { 4980 rc = hmR0SvmRunGuestCodeNested(pVCpu, &cLoops); 4990 rc = hmR0SvmRunGuestCodeNested(pVCpu, &cLoops); 4991 4992 if (rc == VINF_SVM_VMRUN) 4993 { 4994 Assert(CPUMIsGuestInSvmNestedHwVirtMode(pCtx)); 4995 continue; 4996 } 4981 4997 if (rc == VINF_SVM_VMEXIT) 4982 rc = VINF_SUCCESS; 4983 } 4998 { 4999 Assert(!CPUMIsGuestInSvmNestedHwVirtMode(pCtx)); 5000 continue; 5001 } 4984 5002 #endif 4985 4986 /** @todo NSTSVM: Continue in ring-0 after nested-guest \#VMEXIT. See VT-x code for 4987 * reference. */ 5003 break; 5004 } 4988 5005 4989 5006 /* Fixup error codes. */
Note:
See TracChangeset
for help on using the changeset viewer.