Changeset 70000 in vbox
- Timestamp:
- Dec 8, 2017 5:57:18 AM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 119524
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/cpum.h
r69764 r70000 1203 1203 /** @name Nested Hardware-Virtualization Helpers. 1204 1204 * @{ */ 1205 VMM_INT_DECL(bool) CPUMCanSvmNstGstTakePhysIntr(P CCPUMCTX pCtx);1205 VMM_INT_DECL(bool) CPUMCanSvmNstGstTakePhysIntr(PVMCPU pVCpu, PCCPUMCTX pCtx); 1206 1206 VMM_INT_DECL(bool) CPUMCanSvmNstGstTakeVirtIntr(PCCPUMCTX pCtx); 1207 1207 VMM_INT_DECL(uint8_t) CPUMGetSvmNstGstInterrupt(PCCPUMCTX pCtx); … … 1327 1327 * 1328 1328 * @returns @c true if in intercept is set, @c false otherwise. 1329 * @param p Ctx Pointer to the context.1330 * @param fIntercept The SVM control/instruction intercept,1331 * see SVM_CTRL_INTERCEPT_*.1332 * /1333 DECLINLINE(bool) CPUMIsGuestSvmCtrlInterceptSet(PCCPUMCTX pCtx, uint64_t fIntercept) 1334 { 1335 Assert(!pCtx->hwvirt.svm.fHMCachedVmcb); 1329 * @param pVCpu The cross context virtual CPU structure of the calling EMT. 1330 * @param pCtx Pointer to the context. 1331 * @param fIntercept The SVM control/instruction intercept, see 1332 * SVM_CTRL_INTERCEPT_*. 1333 */ 1334 DECLINLINE(bool) CPUMIsGuestSvmCtrlInterceptSet(PVMCPU pVCpu, PCPUMCTX pCtx, uint64_t fIntercept) 1335 { 1336 1336 PCSVMVMCB pVmcb = pCtx->hwvirt.svm.CTX_SUFF(pVmcb); 1337 return pVmcb && (pVmcb->ctrl.u64InterceptCtrl & fIntercept); 1337 if (!pVmcb) 1338 return false; 1339 if (!pCtx->hwvirt.svm.fHMCachedVmcb) 1340 return RT_BOOL(pVmcb->ctrl.u64InterceptCtrl & fIntercept); 1341 return HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, fIntercept); 1338 1342 } 1339 1343 1340 1344 /** 1341 * Checks if the guest VMCB has the specified CR read intercept 1342 * active. 1345 * Checks if the guest VMCB has the specified CR read intercept active. 1343 1346 * 1344 1347 * @returns @c true if in intercept is set, @c false otherwise. 1345 * @param pCtx Pointer to the context. 1346 * @param uCr The CR register number (0 to 15). 1347 */ 1348 DECLINLINE(bool) CPUMIsGuestSvmReadCRxInterceptSet(PCCPUMCTX pCtx, uint8_t uCr) 1349 { 1350 Assert(!pCtx->hwvirt.svm.fHMCachedVmcb); 1348 * @param pVCpu The cross context virtual CPU structure of the calling EMT. 1349 * @param pCtx Pointer to the context. 1350 * @param uCr The CR register number (0 to 15). 1351 */ 1352 DECLINLINE(bool) CPUMIsGuestSvmReadCRxInterceptSet(PVMCPU pVCpu, PCCPUMCTX pCtx, uint8_t uCr) 1353 { 1354 Assert(uCr < 16); 1351 1355 PCSVMVMCB pVmcb = pCtx->hwvirt.svm.CTX_SUFF(pVmcb); 1352 return pVmcb && (pVmcb->ctrl.u16InterceptRdCRx & (1 << uCr)); 1356 if (!pVmcb) 1357 return false; 1358 if (!pCtx->hwvirt.svm.fHMCachedVmcb) 1359 return RT_BOOL(pVmcb->ctrl.u16InterceptRdCRx & (UINT16_C(1) << uCr)); 1360 return HMIsGuestSvmReadCRxInterceptSet(pVCpu, pCtx, uCr); 1353 1361 } 1354 1362 1355 1363 /** 1356 * Checks if the guest VMCB has the specified CR write intercept 1357 * active. 1364 * Checks if the guest VMCB has the specified CR write intercept active. 1358 1365 * 1359 1366 * @returns @c true if in intercept is set, @c false otherwise. 1360 * @param pCtx Pointer to the context. 1361 * @param uCr The CR register number (0 to 15). 1362 */ 1363 DECLINLINE(bool) CPUMIsGuestSvmWriteCRxInterceptSet(PCCPUMCTX pCtx, uint8_t uCr) 1364 { 1365 Assert(!pCtx->hwvirt.svm.fHMCachedVmcb); 1367 * @param pVCpu The cross context virtual CPU structure of the calling EMT. 1368 * @param pCtx Pointer to the context. 1369 * @param uCr The CR register number (0 to 15). 1370 */ 1371 DECLINLINE(bool) CPUMIsGuestSvmWriteCRxInterceptSet(PVMCPU pVCpu, PCCPUMCTX pCtx, uint8_t uCr) 1372 { 1373 Assert(uCr < 16); 1366 1374 PCSVMVMCB pVmcb = pCtx->hwvirt.svm.CTX_SUFF(pVmcb); 1367 return pVmcb && (pVmcb->ctrl.u16InterceptWrCRx & (1 << uCr)); 1375 if (!pVmcb) 1376 return false; 1377 if (!pCtx->hwvirt.svm.fHMCachedVmcb) 1378 return RT_BOOL(pVmcb->ctrl.u16InterceptWrCRx & (UINT16_C(1) << uCr)); 1379 return HMIsGuestSvmWriteCRxInterceptSet(pVCpu, pCtx, uCr); 1368 1380 } 1369 1381 1370 1382 /** 1371 * Checks if the guest VMCB has the specified DR read intercept 1372 * active. 1383 * Checks if the guest VMCB has the specified DR read intercept active. 1373 1384 * 1374 1385 * @returns @c true if in intercept is set, @c false otherwise. 1386 * @param pVCpu The cross context virtual CPU structure of the calling EMT. 1375 1387 * @param pCtx Pointer to the context. 1376 1388 * @param uDr The DR register number (0 to 15). 1377 1389 */ 1378 DECLINLINE(bool) CPUMIsGuestSvmReadDRxInterceptSet(P CCPUMCTX pCtx, uint8_t uDr)1379 { 1380 Assert( !pCtx->hwvirt.svm.fHMCachedVmcb);1390 DECLINLINE(bool) CPUMIsGuestSvmReadDRxInterceptSet(PVMCPU pVCpu, PCCPUMCTX pCtx, uint8_t uDr) 1391 { 1392 Assert(uDr < 16); 1381 1393 PCSVMVMCB pVmcb = pCtx->hwvirt.svm.CTX_SUFF(pVmcb); 1382 return pVmcb && (pVmcb->ctrl.u16InterceptRdDRx & (1 << uDr)); 1394 if (!pVmcb) 1395 return false; 1396 if (!pCtx->hwvirt.svm.fHMCachedVmcb) 1397 return RT_BOOL(pVmcb->ctrl.u16InterceptRdDRx & (UINT16_C(1) << uDr)); 1398 return HMIsGuestSvmReadDRxInterceptSet(pVCpu, pCtx, uDr); 1383 1399 } 1384 1400 1385 1401 /** 1386 * Checks if the guest VMCB has the specified DR write intercept 1387 * active. 1402 * Checks if the guest VMCB has the specified DR write intercept active. 1388 1403 * 1389 1404 * @returns @c true if in intercept is set, @c false otherwise. 1405 * @param pVCpu The cross context virtual CPU structure of the calling EMT. 1390 1406 * @param pCtx Pointer to the context. 1391 1407 * @param uDr The DR register number (0 to 15). 1392 1408 */ 1393 DECLINLINE(bool) CPUMIsGuestSvmWriteDRxInterceptSet(P CCPUMCTX pCtx, uint8_t uDr)1394 { 1395 Assert( !pCtx->hwvirt.svm.fHMCachedVmcb);1409 DECLINLINE(bool) CPUMIsGuestSvmWriteDRxInterceptSet(PVMCPU pVCpu, PCCPUMCTX pCtx, uint8_t uDr) 1410 { 1411 Assert(uDr < 16); 1396 1412 PCSVMVMCB pVmcb = pCtx->hwvirt.svm.CTX_SUFF(pVmcb); 1397 return pVmcb && (pVmcb->ctrl.u16InterceptWrDRx & (1 << uDr)); 1413 if (!pVmcb) 1414 return false; 1415 if (!pCtx->hwvirt.svm.fHMCachedVmcb) 1416 return RT_BOOL(pVmcb->ctrl.u16InterceptWrDRx & (UINT16_C(1) << uDr)); 1417 return HMIsGuestSvmWriteDRxInterceptSet(pVCpu, pCtx, uDr); 1398 1418 } 1399 1419 1400 1420 /** 1401 * Checks if the guest VMCB has the specified exception 1402 * intercept active.1403 * 1404 * @ returns true if in intercept is active, false otherwise.1421 * Checks if the guest VMCB has the specified exception intercept active. 1422 * 1423 * @returns @c true if in intercept is active, @c false otherwise. 1424 * @param pVCpu The cross context virtual CPU structure of the calling EMT. 1405 1425 * @param pCtx Pointer to the context. 1406 1426 * @param uVector The exception / interrupt vector. 1407 1427 */ 1408 DECLINLINE(bool) CPUMIsGuestSvmXcptInterceptSet(PCCPUMCTX pCtx, uint8_t uVector) 1409 { 1410 Assert(!pCtx->hwvirt.svm.fHMCachedVmcb); 1428 DECLINLINE(bool) CPUMIsGuestSvmXcptInterceptSet(PVMCPU pVCpu, PCCPUMCTX pCtx, uint8_t uVector) 1429 { 1411 1430 Assert(uVector < 32); 1412 1431 PCSVMVMCB pVmcb = pCtx->hwvirt.svm.CTX_SUFF(pVmcb); 1413 return pVmcb && (pVmcb->ctrl.u32InterceptXcpt & (UINT32_C(1) << uVector)); 1432 if (!pVmcb) 1433 return false; 1434 if (!pCtx->hwvirt.svm.fHMCachedVmcb) 1435 return RT_BOOL(pVmcb->ctrl.u32InterceptXcpt & (UINT32_C(1) << uVector)); 1436 return HMIsGuestSvmXcptInterceptSet(pVCpu, pCtx, uVector); 1414 1437 } 1415 1438 #endif /* !IN_RC */ … … 1418 1441 * Checks if we are executing inside an SVM nested hardware-virtualized guest. 1419 1442 * 1420 * @returns true if in SVM nested-guest mode,false otherwise.1443 * @returns @c true if in SVM nested-guest mode, @c false otherwise. 1421 1444 * @param pCtx Pointer to the context. 1422 1445 */ … … 1431 1454 return pVmcb && (pVmcb->ctrl.u64InterceptCtrl & SVM_CTRL_INTERCEPT_VMRUN); 1432 1455 #else 1433 RT_NOREF(pCtx);1456 NOREF(pCtx); 1434 1457 return false; 1435 1458 #endif … … 1439 1462 * Checks if we are executing inside a VMX nested hardware-virtualized guest. 1440 1463 * 1441 * @returns true if in VMX nested-guest mode,false otherwise.1464 * @returns @c true if in VMX nested-guest mode, @c false otherwise. 1442 1465 * @param pCtx Pointer to the context. 1443 1466 */ … … 1445 1468 { 1446 1469 /** @todo Intel. */ 1447 RT_NOREF(pCtx);1470 NOREF(pCtx); 1448 1471 return false; 1449 1472 } … … 1452 1475 * Checks if we are executing inside a nested hardware-virtualized guest. 1453 1476 * 1454 * @returns true if in SVM/VMX nested-guest mode,false otherwise.1477 * @returns @c true if in SVM/VMX nested-guest mode, @c false otherwise. 1455 1478 * @param pCtx Pointer to the context. 1456 1479 */ -
trunk/include/VBox/vmm/hm_svm.h
r69996 r70000 1085 1085 } while (0) 1086 1086 1087 VMM_INT_DECL(bool) HMIsGuestSvmCtrlInterceptSet(PVMCPU pVCpu, PCPUMCTX pCtx, uint64_t fIntercept); 1088 VMM_INT_DECL(bool) HMIsGuestSvmReadCRxInterceptSet(PVMCPU pVCpu, PCCPUMCTX pCtx, uint8_t uCr); 1089 VMM_INT_DECL(bool) HMIsGuestSvmWriteCRxInterceptSet(PVMCPU pVCpu, PCCPUMCTX pCtx, uint8_t uCr); 1090 VMM_INT_DECL(bool) HMIsGuestSvmReadDRxInterceptSet(PVMCPU pVCpu, PCCPUMCTX pCtx, uint8_t uDr); 1091 VMM_INT_DECL(bool) HMIsGuestSvmWriteDRxInterceptSet(PVMCPU pVCpu, PCCPUMCTX pCtx, uint8_t uDr); 1092 VMM_INT_DECL(bool) HMIsGuestSvmXcptInterceptSet(PVMCPU pVCpu, PCCPUMCTX pCtx, uint8_t uVector); 1093 VMM_INT_DECL(bool) HMCanSvmNstGstTakePhysIntr(PVMCPU pVCpu, PCCPUMCTX pCtx); 1087 1094 1088 1095 /** @} */ -
trunk/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp
r69819 r70000 2551 2551 * @retval true if it's ready, false otherwise. 2552 2552 * 2553 * @param pCtx The guest-CPU context. 2553 * @param pVCpu The cross context virtual CPU structure of the calling EMT. 2554 * @param pCtx The guest-CPU context. 2554 2555 * 2555 2556 * @sa hmR0SvmCanNstGstTakePhysIntr. 2556 2557 */ 2557 VMM_INT_DECL(bool) CPUMCanSvmNstGstTakePhysIntr(P CCPUMCTX pCtx)2558 VMM_INT_DECL(bool) CPUMCanSvmNstGstTakePhysIntr(PVMCPU pVCpu, PCCPUMCTX pCtx) 2558 2559 { 2559 2560 #ifdef IN_RC 2560 RT_NOREF (pCtx);2561 RT_NOREF2(pVCpu, pCtx); 2561 2562 AssertReleaseFailedReturn(false); 2562 2563 #else 2563 2564 Assert(CPUMIsGuestInSvmNestedHwVirtMode(pCtx)); 2564 2565 Assert(pCtx->hwvirt.svm.fGif); 2565 Assert(!pCtx->hwvirt.svm.fHMCachedVmcb); 2566 2567 PCSVMVMCBCTRL pVmcbCtrl = &pCtx->hwvirt.svm.CTX_SUFF(pVmcb)->ctrl; 2568 X86EFLAGS fEFlags; 2569 if (pVmcbCtrl->IntCtrl.n.u1VIntrMasking) 2570 fEFlags.u = pCtx->hwvirt.svm.HostState.rflags.u; 2571 else 2572 fEFlags.u = pCtx->eflags.u; 2573 2574 return fEFlags.Bits.u1IF; 2566 2567 if (!pCtx->hwvirt.svm.fHMCachedVmcb) 2568 { 2569 PCSVMVMCBCTRL pVmcbCtrl = &pCtx->hwvirt.svm.CTX_SUFF(pVmcb)->ctrl; 2570 X86EFLAGS fEFlags; 2571 if (pVmcbCtrl->IntCtrl.n.u1VIntrMasking) 2572 fEFlags.u = pCtx->hwvirt.svm.HostState.rflags.u; 2573 else 2574 fEFlags.u = pCtx->eflags.u; 2575 2576 return fEFlags.Bits.u1IF; 2577 } 2578 2579 return HMCanSvmNstGstTakePhysIntr(pVCpu, pCtx); 2575 2580 #endif 2576 2581 } -
trunk/src/VBox/VMM/VMMAll/HMSVMAll.cpp
r69930 r70000 374 374 #endif 375 375 376 377 /** 378 * Checks if the guest VMCB has the specified ctrl/instruction intercept active. 379 * 380 * @returns @c true if in intercept is set, @c false otherwise. 381 * @param pVCpu The cross context virtual CPU structure of the calling EMT. 382 * @param pCtx Pointer to the context. 383 * @param fIntercept The SVM control/instruction intercept, see 384 * SVM_CTRL_INTERCEPT_*. 385 */ 386 VMM_INT_DECL(bool) HMIsGuestSvmCtrlInterceptSet(PVMCPU pVCpu, PCPUMCTX pCtx, uint64_t fIntercept) 387 { 388 Assert(pCtx->hwvirt.svm.fHMCachedVmcb); NOREF(pCtx); 389 PCSVMNESTEDVMCBCACHE pVmcbNstGstCache = &pVCpu->hm.s.svm.NstGstVmcbCache; 390 return RT_BOOL(pVmcbNstGstCache->u64InterceptCtrl & fIntercept); 391 } 392 393 394 /** 395 * Checks if the guest VMCB has the specified CR read intercept active. 396 * 397 * @returns @c true if in intercept is set, @c false otherwise. 398 * @param pVCpu The cross context virtual CPU structure of the calling EMT. 399 * @param pCtx Pointer to the context. 400 * @param uCr The CR register number (0 to 15). 401 */ 402 VMM_INT_DECL(bool) HMIsGuestSvmReadCRxInterceptSet(PVMCPU pVCpu, PCCPUMCTX pCtx, uint8_t uCr) 403 { 404 Assert(uCr < 16); 405 Assert(pCtx->hwvirt.svm.fHMCachedVmcb); NOREF(pCtx); 406 PCSVMNESTEDVMCBCACHE pVmcbNstGstCache = &pVCpu->hm.s.svm.NstGstVmcbCache; 407 return RT_BOOL(pVmcbNstGstCache->u16InterceptRdCRx & (1 << uCr)); 408 } 409 410 411 /** 412 * Checks if the guest VMCB has the specified CR write intercept 413 * active. 414 * 415 * @returns @c true if in intercept is set, @c false otherwise. 416 * @param pVCpu The cross context virtual CPU structure of the calling EMT. 417 * @param pCtx Pointer to the context. 418 * @param uCr The CR register number (0 to 15). 419 */ 420 VMM_INT_DECL(bool) HMIsGuestSvmWriteCRxInterceptSet(PVMCPU pVCpu, PCCPUMCTX pCtx, uint8_t uCr) 421 { 422 Assert(uCr < 16); 423 Assert(pCtx->hwvirt.svm.fHMCachedVmcb); NOREF(pCtx); 424 PCSVMNESTEDVMCBCACHE pVmcbNstGstCache = &pVCpu->hm.s.svm.NstGstVmcbCache; 425 return RT_BOOL(pVmcbNstGstCache->u16InterceptWrCRx & (1 << uCr)); 426 } 427 428 429 /** 430 * Checks if the guest VMCB has the specified DR read intercept 431 * active. 432 * 433 * @returns @c true if in intercept is set, @c false otherwise. 434 * @param pVCpu The cross context virtual CPU structure of the calling EMT. 435 * @param pCtx Pointer to the context. 436 * @param uDr The DR register number (0 to 15). 437 */ 438 VMM_INT_DECL(bool) HMIsGuestSvmReadDRxInterceptSet(PVMCPU pVCpu, PCCPUMCTX pCtx, uint8_t uDr) 439 { 440 Assert(uDr < 16); 441 Assert(pCtx->hwvirt.svm.fHMCachedVmcb); NOREF(pCtx); 442 PCSVMNESTEDVMCBCACHE pVmcbNstGstCache = &pVCpu->hm.s.svm.NstGstVmcbCache; 443 return RT_BOOL(pVmcbNstGstCache->u16InterceptRdDRx & (1 << uDr)); 444 } 445 446 447 /** 448 * Checks if the guest VMCB has the specified DR write intercept active. 449 * 450 * @returns @c true if in intercept is set, @c false otherwise. 451 * @param pVCpu The cross context virtual CPU structure of the calling EMT. 452 * @param pCtx Pointer to the context. 453 * @param uDr The DR register number (0 to 15). 454 */ 455 VMM_INT_DECL(bool) HMIsGuestSvmWriteDRxInterceptSet(PVMCPU pVCpu, PCCPUMCTX pCtx, uint8_t uDr) 456 { 457 Assert(uDr < 16); 458 Assert(pCtx->hwvirt.svm.fHMCachedVmcb); NOREF(pCtx); 459 PCSVMNESTEDVMCBCACHE pVmcbNstGstCache = &pVCpu->hm.s.svm.NstGstVmcbCache; 460 return RT_BOOL(pVmcbNstGstCache->u16InterceptWrDRx & (1 << uDr)); 461 } 462 463 464 /** 465 * Checks if the guest VMCB has the specified exception intercept active. 466 * 467 * @returns true if in intercept is active, false otherwise. 468 * @param pVCpu The cross context virtual CPU structure of the calling EMT. 469 * @param pCtx Pointer to the context. 470 * @param uVector The exception / interrupt vector. 471 */ 472 VMM_INT_DECL(bool) HMIsGuestSvmXcptInterceptSet(PVMCPU pVCpu, PCCPUMCTX pCtx, uint8_t uVector) 473 { 474 Assert(uVector < 32); 475 Assert(pCtx->hwvirt.svm.fHMCachedVmcb); NOREF(pCtx); 476 PCSVMNESTEDVMCBCACHE pVmcbNstGstCache = &pVCpu->hm.s.svm.NstGstVmcbCache; 477 return RT_BOOL(pVmcbNstGstCache->u32InterceptXcpt & (1 << uVector)); 478 } 479 480 481 /** 482 * Checks whether the SVM nested-guest is in a state to receive physical (APIC) 483 * interrupts. 484 * 485 * @returns true if it's ready, false otherwise. 486 * @param pCtx The guest-CPU context. 487 * 488 * @remarks This function looks at the VMCB cache rather than directly at the 489 * nested-guest VMCB which may have been suitably modified for executing 490 * using hardware-assisted SVM. 491 * 492 * @sa CPUMCanSvmNstGstTakePhysIntr. 493 */ 494 VMM_INT_DECL(bool) HMCanSvmNstGstTakePhysIntr(PVMCPU pVCpu, PCCPUMCTX pCtx) 495 { 496 Assert(pCtx->hwvirt.svm.fHMCachedVmcb); 497 PCSVMNESTEDVMCBCACHE pVmcbNstGstCache = &pVCpu->hm.s.svm.NstGstVmcbCache; 498 X86EFLAGS fEFlags; 499 if (pVmcbNstGstCache->fVIntrMasking) 500 fEFlags.u = pCtx->hwvirt.svm.HostState.rflags.u; 501 else 502 fEFlags.u = pCtx->eflags.u; 503 504 return fEFlags.Bits.u1IF; 505 } 506 -
trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
r69975 r70000 21 21 *********************************************************************************************************************************/ 22 22 #define LOG_GROUP LOG_GROUP_HM 23 #define VMCPU_INCL_CPUM_GST_CTX 23 24 #include <iprt/asm-amd64-x86.h> 24 25 #include <iprt/thread.h> … … 2198 2199 static void hmR0SvmVmRunSetupVmcb(PVMCPU pVCpu, PCPUMCTX pCtx) 2199 2200 { 2200 RT_NOREF(pVCpu);2201 2201 PSVMVMCB pVmcbNstGst = pCtx->hwvirt.svm.CTX_SUFF(pVmcb); 2202 2202 PSVMVMCBCTRL pVmcbNstGstCtrl = &pVmcbNstGst->ctrl; … … 2253 2253 Assert(pVmcbNstGst); 2254 2254 2255 hmR0SvmVmRunSetupVmcb(pVCpu, pCtx); 2255 2256 hmR0SvmLoadGuestSegmentRegs(pVCpu, pVmcbNstGst, pCtx); 2256 2257 hmR0SvmLoadGuestMsrs(pVCpu, pVmcbNstGst, pCtx); … … 2709 2710 HMCPU_CF_SET(pVCpu, HM_CHANGED_ALL_GUEST); 2710 2711 2711 #ifdef VBOX_WITH_NESTED_HWVIRT2712 /*2713 * We may inspect the nested-guest VMCB state in ring-3 (e.g. for injecting interrupts)2714 * and thus we need to restore any modifications we may have made to it here if we're2715 * still executing the nested-guest.2716 */2717 if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx))2718 HMSvmNstGstVmExitNotify(pVCpu, pCtx);2719 #endif2720 2721 2712 STAM_COUNTER_INC(&pVCpu->hm.s.StatSwitchExitToR3); 2722 2713 … … 3170 3161 3171 3162 #ifdef VBOX_WITH_NESTED_HWVIRT 3172 /**3173 * Checks whether the SVM nested-guest is in a state to receive physical (APIC)3174 * interrupts.3175 *3176 * @returns true if it's ready, false otherwise.3177 * @param pCtx The guest-CPU context.3178 *3179 * @remarks This function looks at the VMCB cache rather than directly at the3180 * nested-guest VMCB which may have been suitably modified for executing3181 * using hardware-assisted SVM.3182 *3183 * @sa CPUMCanSvmNstGstTakePhysIntr.3184 */3185 static bool hmR0SvmCanNstGstTakePhysIntr(PVMCPU pVCpu, PCCPUMCTX pCtx)3186 {3187 Assert(pCtx->hwvirt.svm.fHMCachedVmcb);3188 PCSVMNESTEDVMCBCACHE pVmcbNstGstCache = &pVCpu->hm.s.svm.NstGstVmcbCache;3189 X86EFLAGS fEFlags;3190 if (pVmcbNstGstCache->fVIntrMasking)3191 fEFlags.u = pCtx->hwvirt.svm.HostState.rflags.u;3192 else3193 fEFlags.u = pCtx->eflags.u;3194 3195 return fEFlags.Bits.u1IF;3196 }3197 3163 3198 3164 … … 3265 3231 */ 3266 3232 PCSVMNESTEDVMCBCACHE pVmcbNstGstCache = &pVCpu->hm.s.svm.NstGstVmcbCache; 3267 Assert(pCtx->hwvirt.svm.fHMCachedVmcb);3268 3233 if ( VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC) 3269 3234 && !fIntShadow 3270 3235 && !pVCpu->hm.s.fSingleInstruction 3271 && hmR0SvmCanNstGstTakePhysIntr(pVCpu, pCtx))3236 && CPUMCanSvmNstGstTakePhysIntr(pVCpu, pCtx)) 3272 3237 { 3273 3238 if (pVmcbNstGstCache->u64InterceptCtrl & SVM_CTRL_INTERCEPT_INTR) … … 3753 3718 return rc; 3754 3719 3755 hmR0SvmVmRunSetupVmcb(pVCpu, pCtx);3756 3757 3720 if (TRPMHasTrap(pVCpu)) 3758 3721 hmR0SvmTrpmTrapToPendingEvent(pVCpu); … … 3781 3744 rc = hmR0SvmLoadGuestStateNested(pVCpu, pCtx); 3782 3745 AssertRCReturn(rc, rc); 3783 /** @todo Get new STAM counter for this? */3784 STAM_COUNTER_INC(&pVCpu->hm.s.StatLoadFull); 3785 3746 STAM_COUNTER_INC(&pVCpu->hm.s.StatLoadFull); /** @todo Get new STAM counter for this? */ 3747 3748 /* Ensure we've cached (and hopefully modified) the VMCB for execution using hardware SVM. */ 3786 3749 Assert(pCtx->hwvirt.svm.fHMCachedVmcb); 3787 3750 … … 4311 4274 hmR0SvmSaveGuestState(pVCpu, pMixedCtx, pVmcbNstGst); /* Save the nested-guest state from the VMCB to the 4312 4275 guest-CPU context. */ 4313 4314 HMSvmNstGstVmExitNotify(pVCpu, pMixedCtx); /* Restore modified VMCB fields for now, see @bugref{7243#c52} .*/4315 4276 } 4316 4277 #endif … … 4752 4713 #define HM_SVM_VMEXIT_NESTED(a_pVCpu, a_uExitCode, a_uExitInfo1, a_uExitInfo2) \ 4753 4714 VBOXSTRICTRC_TODO(IEMExecSvmVmexit(a_pVCpu, a_uExitCode, a_uExitInfo1, a_uExitInfo2)) 4754 #define HM_SVM_IS_CTRL_INTERCEPT_SET(a_pCtx, a_Intercept) CPUMIsGuestSvmCtrlInterceptSet(a_pCtx, (a_Intercept))4755 #define HM_SVM_IS_XCPT_INTERCEPT_SET(a_pCtx, a_Xcpt) CPUMIsGuestSvmXcptInterceptSet(a_pCtx, (a_Xcpt))4756 #define HM_SVM_IS_READ_CR_INTERCEPT_SET(a_pCtx, a_uCr) CPUMIsGuestSvmReadCRxInterceptSet(a_pCtx, (a_uCr))4757 #define HM_SVM_IS_READ_DR_INTERCEPT_SET(a_pCtx, a_uDr) CPUMIsGuestSvmReadDRxInterceptSet(a_pCtx, (a_uDr))4758 #define HM_SVM_IS_WRITE_CR_INTERCEPT_SET(a_pCtx, a_uCr) CPUMIsGuestSvmWriteCRxInterceptSet(a_pCtx, (a_uCr))4759 #define HM_SVM_IS_WRITE_DR_INTERCEPT_SET(a_pCtx, a_uDr) CPUMIsGuestSvmWriteDRxInterceptSet(a_pCtx, (a_uDr))4760 4715 4761 4716 /* … … 4774 4729 case SVM_EXIT_CPUID: 4775 4730 { 4776 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_CPUID))4731 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_CPUID)) 4777 4732 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 4778 4733 return hmR0SvmExitCpuid(pVCpu, pCtx, pSvmTransient); … … 4781 4736 case SVM_EXIT_RDTSC: 4782 4737 { 4783 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_RDTSC))4738 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_RDTSC)) 4784 4739 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 4785 4740 return hmR0SvmExitRdtsc(pVCpu, pCtx, pSvmTransient); … … 4788 4743 case SVM_EXIT_RDTSCP: 4789 4744 { 4790 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_RDTSCP))4745 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_RDTSCP)) 4791 4746 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 4792 4747 return hmR0SvmExitRdtscp(pVCpu, pCtx, pSvmTransient); … … 4796 4751 case SVM_EXIT_MONITOR: 4797 4752 { 4798 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_MONITOR))4753 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_MONITOR)) 4799 4754 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 4800 4755 return hmR0SvmExitMonitor(pVCpu, pCtx, pSvmTransient); … … 4803 4758 case SVM_EXIT_MWAIT: 4804 4759 { 4805 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_MWAIT))4760 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_MWAIT)) 4806 4761 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 4807 4762 return hmR0SvmExitMwait(pVCpu, pCtx, pSvmTransient); … … 4810 4765 case SVM_EXIT_HLT: 4811 4766 { 4812 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_HLT))4767 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_HLT)) 4813 4768 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 4814 4769 return hmR0SvmExitHlt(pVCpu, pCtx, pSvmTransient); … … 4817 4772 case SVM_EXIT_MSR: 4818 4773 { 4819 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_MSR_PROT))4774 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_MSR_PROT)) 4820 4775 { 4821 4776 uint32_t const idMsr = pCtx->ecx; … … 4853 4808 * Figure out if the IO port access is intercepted by the nested-guest. 4854 4809 */ 4855 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_IOIO_PROT))4810 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_IOIO_PROT)) 4856 4811 { 4857 4812 void *pvIoBitmap = pCtx->hwvirt.svm.CTX_SUFF(pvIoBitmap); … … 4874 4829 4875 4830 /* If the nested-guest is intercepting #PFs, cause a #PF #VMEXIT. */ 4876 if (HM _SVM_IS_XCPT_INTERCEPT_SET(pCtx, X86_XCPT_PF))4831 if (HMIsGuestSvmXcptInterceptSet(pVCpu, pCtx, X86_XCPT_PF)) 4877 4832 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, u32ErrCode, uFaultAddress); 4878 4833 … … 4886 4841 case SVM_EXIT_EXCEPTION_7: /* X86_XCPT_NM */ 4887 4842 { 4888 if (HM _SVM_IS_XCPT_INTERCEPT_SET(pCtx, X86_XCPT_NM))4843 if (HMIsGuestSvmXcptInterceptSet(pVCpu, pCtx, X86_XCPT_NM)) 4889 4844 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 4890 4845 hmR0SvmSetPendingXcptNM(pVCpu); … … 4894 4849 case SVM_EXIT_EXCEPTION_6: /* X86_XCPT_UD */ 4895 4850 { 4896 if (HM _SVM_IS_XCPT_INTERCEPT_SET(pCtx, X86_XCPT_UD))4851 if (HMIsGuestSvmXcptInterceptSet(pVCpu, pCtx, X86_XCPT_UD)) 4897 4852 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 4898 4853 hmR0SvmSetPendingXcptUD(pVCpu); … … 4902 4857 case SVM_EXIT_EXCEPTION_16: /* X86_XCPT_MF */ 4903 4858 { 4904 if (HM _SVM_IS_XCPT_INTERCEPT_SET(pCtx, X86_XCPT_MF))4859 if (HMIsGuestSvmXcptInterceptSet(pVCpu, pCtx, X86_XCPT_MF)) 4905 4860 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 4906 4861 hmR0SvmSetPendingXcptMF(pVCpu); … … 4910 4865 case SVM_EXIT_EXCEPTION_1: /* X86_XCPT_DB */ 4911 4866 { 4912 if (HM _SVM_IS_XCPT_INTERCEPT_SET(pCtx, X86_XCPT_DB))4867 if (HMIsGuestSvmXcptInterceptSet(pVCpu, pCtx, X86_XCPT_DB)) 4913 4868 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 4914 4869 return hmR0SvmNestedExitXcptDB(pVCpu, pCtx, pSvmTransient); … … 4917 4872 case SVM_EXIT_EXCEPTION_17: /* X86_XCPT_AC */ 4918 4873 { 4919 if (HM _SVM_IS_XCPT_INTERCEPT_SET(pCtx, X86_XCPT_AC))4874 if (HMIsGuestSvmXcptInterceptSet(pVCpu, pCtx, X86_XCPT_AC)) 4920 4875 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 4921 4876 return hmR0SvmExitXcptAC(pVCpu, pCtx, pSvmTransient); … … 4924 4879 case SVM_EXIT_EXCEPTION_3: /* X86_XCPT_BP */ 4925 4880 { 4926 if (HM _SVM_IS_XCPT_INTERCEPT_SET(pCtx, X86_XCPT_BP))4881 if (HMIsGuestSvmXcptInterceptSet(pVCpu, pCtx, X86_XCPT_BP)) 4927 4882 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 4928 4883 return hmR0SvmNestedExitXcptBP(pVCpu, pCtx, pSvmTransient); … … 4933 4888 case SVM_EXIT_READ_CR4: 4934 4889 { 4935 if (HM_SVM_IS_READ_CR_INTERCEPT_SET(pCtx, (1U << (uint16_t)(pSvmTransient->u64ExitCode - SVM_EXIT_READ_CR0)))) 4890 uint8_t const uCr = uExitCode - SVM_EXIT_READ_CR0; 4891 if (HMIsGuestSvmReadCRxInterceptSet(pVCpu, pCtx, uCr)) 4936 4892 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 4937 4893 return hmR0SvmExitReadCRx(pVCpu, pCtx, pSvmTransient); … … 4943 4899 case SVM_EXIT_WRITE_CR8: /** @todo Shouldn't writes to CR8 go to V_TPR instead since we run with V_INTR_MASKING set?? */ 4944 4900 { 4901 uint8_t const uCr = uExitCode - SVM_EXIT_WRITE_CR0; 4945 4902 Log4(("hmR0SvmHandleExitNested: Write CRx: u16InterceptWrCRx=%#x u64ExitCode=%#RX64 %#x\n", 4946 pVmcbNstGstCtrl->u16InterceptWrCRx, pSvmTransient->u64ExitCode, 4947 (1U << (uint16_t)(pSvmTransient->u64ExitCode - SVM_EXIT_WRITE_CR0)))); 4948 4949 if (HM_SVM_IS_WRITE_CR_INTERCEPT_SET(pCtx, (1U << (uint16_t)(pSvmTransient->u64ExitCode - SVM_EXIT_WRITE_CR0)))) 4903 pVmcbNstGstCtrl->u16InterceptWrCRx, pSvmTransient->u64ExitCode, uCr)); 4904 4905 if (HMIsGuestSvmWriteCRxInterceptSet(pVCpu, pCtx, uCr)) 4950 4906 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 4951 4907 return hmR0SvmExitWriteCRx(pVCpu, pCtx, pSvmTransient); … … 4954 4910 case SVM_EXIT_PAUSE: 4955 4911 { 4956 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_PAUSE))4912 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_PAUSE)) 4957 4913 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 4958 4914 return hmR0SvmExitPause(pVCpu, pCtx, pSvmTransient); … … 4961 4917 case SVM_EXIT_VINTR: 4962 4918 { 4963 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_VINTR))4919 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_VINTR)) 4964 4920 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 4965 4921 return hmR0SvmExitUnexpected(pVCpu, pCtx, pSvmTransient); … … 4974 4930 case SVM_EXIT_FERR_FREEZE: 4975 4931 { 4976 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_FERR_FREEZE))4932 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_FERR_FREEZE)) 4977 4933 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 4978 4934 return hmR0SvmExitIntr(pVCpu, pCtx, pSvmTransient); … … 4981 4937 case SVM_EXIT_NMI: 4982 4938 { 4983 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_NMI))4939 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_NMI)) 4984 4940 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 4985 4941 return hmR0SvmExitIntr(pVCpu, pCtx, pSvmTransient); … … 4988 4944 case SVM_EXIT_INVLPG: 4989 4945 { 4990 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_INVLPG))4946 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_INVLPG)) 4991 4947 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 4992 4948 return hmR0SvmExitInvlpg(pVCpu, pCtx, pSvmTransient); … … 4995 4951 case SVM_EXIT_WBINVD: 4996 4952 { 4997 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_WBINVD))4953 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_WBINVD)) 4998 4954 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 4999 4955 return hmR0SvmExitWbinvd(pVCpu, pCtx, pSvmTransient); … … 5002 4958 case SVM_EXIT_INVD: 5003 4959 { 5004 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_INVD))4960 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_INVD)) 5005 4961 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 5006 4962 return hmR0SvmExitInvd(pVCpu, pCtx, pSvmTransient); … … 5009 4965 case SVM_EXIT_RDPMC: 5010 4966 { 5011 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_RDPMC))4967 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_RDPMC)) 5012 4968 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 5013 4969 return hmR0SvmExitRdpmc(pVCpu, pCtx, pSvmTransient); … … 5023 4979 case SVM_EXIT_READ_DR14: case SVM_EXIT_READ_DR15: 5024 4980 { 5025 if (HM_SVM_IS_READ_DR_INTERCEPT_SET(pCtx, (1U << (uint16_t)(pSvmTransient->u64ExitCode - SVM_EXIT_READ_DR0)))) 4981 uint8_t const uDr = uExitCode - SVM_EXIT_READ_DR0; 4982 if (HMIsGuestSvmReadDRxInterceptSet(pVCpu, pCtx, uDr)) 5026 4983 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 5027 4984 return hmR0SvmExitReadDRx(pVCpu, pCtx, pSvmTransient); … … 5033 4990 case SVM_EXIT_WRITE_DR14: case SVM_EXIT_WRITE_DR15: 5034 4991 { 5035 if (HM_SVM_IS_WRITE_DR_INTERCEPT_SET(pCtx, (1U << (uint16_t)(pSvmTransient->u64ExitCode - SVM_EXIT_WRITE_DR0)))) 4992 uint8_t const uDr = uExitCode - SVM_EXIT_WRITE_DR0; 4993 if (HMIsGuestSvmWriteDRxInterceptSet(pVCpu, pCtx, uDr)) 5036 4994 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 5037 4995 return hmR0SvmExitWriteDRx(pVCpu, pCtx, pSvmTransient); … … 5051 5009 case SVM_EXIT_EXCEPTION_30: case SVM_EXIT_EXCEPTION_31: 5052 5010 { 5053 if (HM_SVM_IS_XCPT_INTERCEPT_SET(pCtx, (uint32_t)(pSvmTransient->u64ExitCode - SVM_EXIT_EXCEPTION_0))) 5011 uint8_t const uVector = uExitCode - SVM_EXIT_EXCEPTION_0; 5012 if (HMIsGuestSvmXcptInterceptSet(pVCpu, pCtx, uVector)) 5054 5013 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 5055 5014 /** @todo Write hmR0SvmExitXcptGeneric! */ … … 5059 5018 case SVM_EXIT_XSETBV: 5060 5019 { 5061 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_XSETBV))5020 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_XSETBV)) 5062 5021 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 5063 5022 return hmR0SvmExitXsetbv(pVCpu, pCtx, pSvmTransient); … … 5066 5025 case SVM_EXIT_TASK_SWITCH: 5067 5026 { 5068 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_TASK_SWITCH))5027 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_TASK_SWITCH)) 5069 5028 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 5070 5029 return hmR0SvmExitTaskSwitch(pVCpu, pCtx, pSvmTransient); … … 5073 5032 case SVM_EXIT_IRET: 5074 5033 { 5075 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_IRET))5034 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_IRET)) 5076 5035 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 5077 5036 return hmR0SvmExitIret(pVCpu, pCtx, pSvmTransient); … … 5080 5039 case SVM_EXIT_SHUTDOWN: 5081 5040 { 5082 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_SHUTDOWN))5041 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_SHUTDOWN)) 5083 5042 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 5084 5043 return hmR0SvmExitShutdown(pVCpu, pCtx, pSvmTransient); … … 5087 5046 case SVM_EXIT_SMI: 5088 5047 { 5089 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_SMI))5048 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_SMI)) 5090 5049 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 5091 5050 return hmR0SvmExitUnexpected(pVCpu, pCtx, pSvmTransient); … … 5094 5053 case SVM_EXIT_INIT: 5095 5054 { 5096 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_INIT))5055 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_INIT)) 5097 5056 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 5098 5057 return hmR0SvmExitUnexpected(pVCpu, pCtx, pSvmTransient); … … 5101 5060 case SVM_EXIT_VMMCALL: 5102 5061 { 5103 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_VMMCALL))5062 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_VMMCALL)) 5104 5063 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 5105 5064 return hmR0SvmExitVmmCall(pVCpu, pCtx, pSvmTransient); … … 5108 5067 case SVM_EXIT_CLGI: 5109 5068 { 5110 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_CLGI))5069 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_CLGI)) 5111 5070 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 5112 5071 return hmR0SvmExitClgi(pVCpu, pCtx, pSvmTransient); … … 5115 5074 case SVM_EXIT_STGI: 5116 5075 { 5117 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_STGI))5076 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_STGI)) 5118 5077 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 5119 5078 return hmR0SvmExitStgi(pVCpu, pCtx, pSvmTransient); … … 5122 5081 case SVM_EXIT_VMLOAD: 5123 5082 { 5124 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_VMLOAD))5083 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_VMLOAD)) 5125 5084 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 5126 5085 return hmR0SvmExitVmload(pVCpu, pCtx, pSvmTransient); … … 5129 5088 case SVM_EXIT_VMSAVE: 5130 5089 { 5131 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_VMSAVE))5090 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_VMSAVE)) 5132 5091 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 5133 5092 return hmR0SvmExitVmsave(pVCpu, pCtx, pSvmTransient); … … 5136 5095 case SVM_EXIT_INVLPGA: 5137 5096 { 5138 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_INVLPGA))5097 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_INVLPGA)) 5139 5098 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 5140 5099 return hmR0SvmExitInvlpga(pVCpu, pCtx, pSvmTransient); … … 5143 5102 case SVM_EXIT_VMRUN: 5144 5103 { 5145 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_VMRUN))5104 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_VMRUN)) 5146 5105 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 5147 5106 return hmR0SvmExitVmrun(pVCpu, pCtx, pSvmTransient); … … 5150 5109 case SVM_EXIT_RSM: 5151 5110 { 5152 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_RSM))5111 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_RSM)) 5153 5112 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 5154 5113 hmR0SvmSetPendingXcptUD(pVCpu); … … 5158 5117 case SVM_EXIT_SKINIT: 5159 5118 { 5160 if (HM _SVM_IS_CTRL_INTERCEPT_SET(pCtx, SVM_CTRL_INTERCEPT_SKINIT))5119 if (HMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_SKINIT)) 5161 5120 return HM_SVM_VMEXIT_NESTED(pVCpu, uExitCode, uExitInfo1, uExitInfo2); 5162 5121 hmR0SvmSetPendingXcptUD(pVCpu); … … 5182 5141 5183 5142 #undef HM_SVM_VMEXIT_NESTED 5184 #undef HM_SVM_IS_CTRL_INTERCEPT_SET5185 #undef HM_SVM_IS_XCPT_INTERCEPT_SET5186 #undef HM_SVM_IS_READ_CR_INTERCEPT_SET5187 #undef HM_SVM_IS_READ_DR_INTERCEPT_SET5188 #undef HM_SVM_IS_WRITE_CR_INTERCEPT_SET5189 #undef HM_SVM_IS_WRITE_DR_INTERCEPT_SET5190 5143 } 5191 5144 #endif -
trunk/src/VBox/VMM/VMMR3/EM.cpp
r69142 r70000 1973 1973 { 1974 1974 if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx)) 1975 fIntrEnabled = CPUMCanSvmNstGstTakePhysIntr(p Ctx);1975 fIntrEnabled = CPUMCanSvmNstGstTakePhysIntr(pVCpu, pCtx); 1976 1976 else 1977 1977 fIntrEnabled = pCtx->eflags.Bits.u1IF; … … 1987 1987 { 1988 1988 #ifdef VBOX_WITH_NESTED_HWVIRT 1989 if (CPUMIsGuestSvmCtrlInterceptSet(p Ctx, SVM_CTRL_INTERCEPT_INTR))1989 if (CPUMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_INTR)) 1990 1990 { 1991 1991 VBOXSTRICTRC rcStrict = IEMExecSvmVmexit(pVCpu, SVM_EXIT_INTR, 0, 0); … … 2027 2027 if (CPUMCanSvmNstGstTakeVirtIntr(pCtx)) 2028 2028 { 2029 if (CPUMIsGuestSvmCtrlInterceptSet(p Ctx, SVM_CTRL_INTERCEPT_VINTR))2029 if (CPUMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_VINTR)) 2030 2030 { 2031 2031 VBOXSTRICTRC rcStrict = IEMExecSvmVmexit(pVCpu, SVM_EXIT_VINTR, 0, 0);
Note:
See TracChangeset
for help on using the changeset viewer.