- Timestamp:
- Jun 5, 2017 6:20:55 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp
r66403 r67258 2543 2543 } 2544 2544 2545 2546 /** 2547 * Checks whether the SVM nested-guest is in a state to receive physical (APIC) 2548 * interrupts. 2549 * 2550 * @returns VBox status code. 2551 * @retval true if it's ready, false otherwise. 2552 * 2553 * @param pCtx The guest-CPU context. 2554 */ 2555 VMM_INT_DECL(bool) CPUMCanSvmNstGstTakePhysIntr(PCCPUMCTX pCtx) 2556 { 2557 Assert(CPUMIsGuestInSvmNestedHwVirtMode(pCtx)); 2558 2559 PCSVMVMCBCTRL pVmcbCtrl = &pCtx->hwvirt.svm.VmcbCtrl; 2560 X86EFLAGS fEFlags; 2561 if (!pVmcbCtrl->IntCtrl.n.u1VIntrMasking) 2562 fEFlags.u = pCtx->hwvirt.svm.HostState.rflags.u; 2563 else 2564 fEFlags.u = pCtx->eflags.u; 2565 2566 return pCtx->hwvirt.svm.fGif && fEFlags.Bits.u1IF; 2567 } 2568 2569 2570 /** 2571 * Checks whether the SVM nested-guest is in a state to receive virtual 2572 * (injected by VMRUN) interrupts. 2573 * 2574 * @returns VBox status code. 2575 * @retval true if it's ready, false otherwise. 2576 * 2577 * @param pCtx The guest-CPU context. 2578 */ 2579 VMM_INT_DECL(bool) CPUMCanSvmNstGstTakeVirtIntr(PCCPUMCTX pCtx) 2580 { 2581 Assert(CPUMIsGuestInSvmNestedHwVirtMode(pCtx)); 2582 2583 PCSVMVMCBCTRL pVmcbCtrl = &pCtx->hwvirt.svm.VmcbCtrl; 2584 if ( !pVmcbCtrl->IntCtrl.n.u1IgnoreTPR 2585 && pVmcbCtrl->IntCtrl.n.u4VIntrPrio <= pVmcbCtrl->IntCtrl.n.u8VTPR) 2586 return false; 2587 2588 if (!pCtx->rflags.Bits.u1IF) 2589 return false; 2590 2591 if (!pCtx->hwvirt.svm.fGif) 2592 return false; 2593 2594 return true; 2595 } 2596 2597 2598 /** 2599 * Gets the pending SVM nested-guest interrupt. 2600 * 2601 * @returns The nested-guest interrupt to inject. 2602 * @param pCtx The guest-CPU context. 2603 */ 2604 VMM_INT_DECL(uint8_t) CPUMGetSvmNstGstInterrupt(PCCPUMCTX pCtx) 2605 { 2606 PCSVMVMCBCTRL pVmcbCtrl = &pCtx->hwvirt.svm.VmcbCtrl; 2607 return pVmcbCtrl->IntCtrl.n.u8VIntrVector; 2608 } 2609
Note:
See TracChangeset
for help on using the changeset viewer.