Changeset 96747 in vbox for trunk/src/VBox
- Timestamp:
- Sep 15, 2022 4:58:38 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/VMXAllTemplate.cpp.h
r96407 r96747 261 261 static FNVMXEXITHANDLER vmxHCExitXsetbv; 262 262 static FNVMXEXITHANDLER vmxHCExitInvpcid; 263 #ifndef VBOX_WITH_NESTED_HWVIRT_VMX_EPT 263 264 static FNVMXEXITHANDLERNSRC vmxHCExitSetPendingXcptUD; 265 #endif 264 266 static FNVMXEXITHANDLERNSRC vmxHCExitErrInvalidGuestState; 265 267 static FNVMXEXITHANDLERNSRC vmxHCExitErrUnexpected; … … 675 677 /* 48 VMX_EXIT_EPT_VIOLATION */ { vmxHCExitEptViolation }, 676 678 /* 49 VMX_EXIT_EPT_MISCONFIG */ { vmxHCExitEptMisconfig }, 677 #if defined(VBOX_WITH_NESTED_HWVIRT_VMX) && defined(VBOX_WITH_NESTED_HWVIRT_VMX_EPT)679 #ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT 678 680 /* 50 VMX_EXIT_INVEPT */ { vmxHCExitInvept }, 679 681 #else … … 2364 2366 /* 2365 2367 * With nested-guests, we may have extended the guest/host mask here (since we 2366 * merged in the outer guest's mask, see vmxHCMergeVmcsNested). This means, the2368 * merged in the outer guest's mask, see hmR0VmxMergeVmcsNested). This means, the 2367 2369 * mask can include more bits (to read from the nested-guest CR4 read-shadow) than 2368 2370 * the nested hypervisor originally supplied. Thus, we should, in essence, copy … … 5362 5364 return vmxHCExitSetPendingXcptUD(pVCpu, pVmxTransient); 5363 5365 #endif 5364 #if defined(VBOX_WITH_NESTED_HWVIRT_VMX) && defined(VBOX_WITH_NESTED_HWVIRT_VMX_EPT)5366 #ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT 5365 5367 case VMX_EXIT_INVEPT: VMEXIT_CALL_RET(0, vmxHCExitInvept(pVCpu, pVmxTransient)); 5366 5368 #else … … 5433 5435 /* 5434 5436 * Instructions that cause VM-exits unconditionally or the condition is 5435 * always istaken solely from the nested hypervisor (meaning if the VM-exit5437 * always taken solely from the nested hypervisor (meaning if the VM-exit 5436 5438 * happens, it's guaranteed to be a nested-guest VM-exit). 5437 5439 * … … 5452 5454 /* 5453 5455 * Instructions that cause VM-exits unconditionally or the condition is 5454 * always istaken solely from the nested hypervisor (meaning if the VM-exit5456 * always taken solely from the nested hypervisor (meaning if the VM-exit 5455 5457 * happens, it's guaranteed to be a nested-guest VM-exit). 5456 5458 * … … 7525 7527 7526 7528 7529 #ifndef VBOX_WITH_NESTED_HWVIRT_VMX_EPT 7527 7530 /** 7528 7531 * VM-exit handler for instructions that result in a \#UD exception delivered to … … 7535 7538 return VINF_SUCCESS; 7536 7539 } 7540 #endif 7537 7541 7538 7542 … … 10275 10279 if (CPUMIsGuestVmxProcCtls2Set(&pVCpu->cpum.GstCtx, VMX_PROC_CTLS2_EPT)) 10276 10280 { 10277 int rc = vmxHCImportGuestState(pVCpu, pVmcsInfo, IEM_CPUMCTX_EXTRN_MUST_MASK);10281 int rc = vmxHCImportGuestState(pVCpu, pVmcsInfo, HMVMX_CPUMCTX_EXTRN_ALL); 10278 10282 AssertRCReturn(rc, rc); 10279 10283 10280 10284 vmxHCReadExitQualVmcs(pVCpu, pVmxTransient); 10281 vmxHCReadExitInstrLenVmcs(pVCpu, pVmxTransient);10282 10285 vmxHCReadGuestPhysicalAddrVmcs(pVCpu, pVmxTransient); 10283 10286 10284 RTGCPHYS const GCPhysNested = pVmxTransient->uGuestPhysicalAddr;10285 uint64_t const uExitQual = pVmxTransient->uExitQual;10286 10287 RTGCPTR GCPtrNested ;10287 RTGCPHYS const GCPhysNestedFault = pVmxTransient->uGuestPhysicalAddr; 10288 uint64_t const uExitQual = pVmxTransient->uExitQual; 10289 10290 RTGCPTR GCPtrNestedFault; 10288 10291 bool const fIsLinearAddrValid = RT_BOOL(uExitQual & VMX_EXIT_QUAL_EPT_LINEAR_ADDR_VALID); 10289 10292 if (fIsLinearAddrValid) 10290 10293 { 10291 10294 vmxHCReadGuestLinearAddrVmcs(pVCpu, pVmxTransient); 10292 GCPtrNested = pVmxTransient->uGuestLinearAddr;10295 GCPtrNestedFault = pVmxTransient->uGuestLinearAddr; 10293 10296 } 10294 10297 else 10295 GCPtrNested = 0;10298 GCPtrNestedFault = 0; 10296 10299 10297 10300 RTGCUINT const uErr = ((uExitQual & VMX_EXIT_QUAL_EPT_ACCESS_INSTR_FETCH) ? X86_TRAP_PF_ID : 0) … … 10303 10306 PGMPTWALK Walk; 10304 10307 PCPUMCTX pCtx = &pVCpu->cpum.GstCtx; 10305 VBOXSTRICTRC rcStrict = PGMR0NestedTrap0eHandlerNestedPaging(pVCpu, PGMMODE_EPT, uErr, CPUMCTX2CORE(pCtx), GCPhysNested, 10306 fIsLinearAddrValid, GCPtrNested, &Walk); 10308 VBOXSTRICTRC rcStrict = PGMR0NestedTrap0eHandlerNestedPaging(pVCpu, PGMMODE_EPT, uErr, CPUMCTX2CORE(pCtx), 10309 GCPhysNestedFault, fIsLinearAddrValid, GCPtrNestedFault, 10310 &Walk); 10307 10311 if (RT_SUCCESS(rcStrict)) 10308 {10309 if (rcStrict == VINF_SUCCESS)10310 ASMAtomicUoOrU64(&VCPU_2_VMXSTATE(pVCpu).fCtxChanged, HM_CHANGED_GUEST_RIP | HM_CHANGED_GUEST_RFLAGS);10311 else if (rcStrict == VINF_IEM_RAISED_XCPT)10312 {10313 ASMAtomicUoOrU64(&VCPU_2_VMXSTATE(pVCpu).fCtxChanged, HM_CHANGED_RAISED_XCPT_MASK);10314 rcStrict = VINF_SUCCESS;10315 }10316 10312 return rcStrict; 10317 } 10318 10313 10314 vmxHCReadExitInstrLenVmcs(pVCpu, pVmxTransient); 10319 10315 vmxHCReadIdtVectoringInfoVmcs(pVCpu, pVmxTransient); 10320 10316 vmxHCReadIdtVectoringErrorCodeVmcs(pVCpu, pVmxTransient); … … 10357 10353 if (CPUMIsGuestVmxProcCtls2Set(&pVCpu->cpum.GstCtx, VMX_PROC_CTLS2_EPT)) 10358 10354 { 10359 int rc = vmxHCImportGuestState(pVCpu, pVmcsInfo, IEM_CPUMCTX_EXTRN_MUST_MASK);10355 int rc = vmxHCImportGuestState(pVCpu, pVmcsInfo, CPUMCTX_EXTRN_ALL); 10360 10356 AssertRCReturn(rc, rc); 10361 10357 … … 10364 10360 PGMPTWALK Walk; 10365 10361 PCPUMCTX pCtx = &pVCpu->cpum.GstCtx; 10366 RTGCPHYS const GCPhysNested = pVmxTransient->uGuestPhysicalAddr;10362 RTGCPHYS const GCPhysNestedFault = pVmxTransient->uGuestPhysicalAddr; 10367 10363 VBOXSTRICTRC rcStrict = PGMR0NestedTrap0eHandlerNestedPaging(pVCpu, PGMMODE_EPT, X86_TRAP_PF_RSVD, CPUMCTX2CORE(pCtx), 10368 GCPhysNested , false /* fIsLinearAddrValid */,10369 0 /* GCPtrNested */, &Walk);10364 GCPhysNestedFault, false /* fIsLinearAddrValid */, 10365 0 /* GCPtrNestedFault */, &Walk); 10370 10366 if (RT_SUCCESS(rcStrict)) 10371 return VINF_EM_RAW_EMULATE_INSTR; 10372 10367 { 10368 AssertMsgFailed(("Shouldn't happen with the way we have programmed the EPT shadow tables\n")); 10369 return rcStrict; 10370 } 10371 10372 AssertMsg(Walk.fFailed & PGM_WALKFAIL_EPT_MISCONFIG, ("GCPhysNestedFault=%#RGp\n", GCPhysNestedFault)); 10373 10373 vmxHCReadIdtVectoringInfoVmcs(pVCpu, pVmxTransient); 10374 10374 vmxHCReadIdtVectoringErrorCodeVmcs(pVCpu, pVmxTransient);
Note:
See TracChangeset
for help on using the changeset viewer.