Changeset 72065 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Apr 30, 2018 6:27:34 AM (7 years ago)
- Location:
- trunk/src/VBox/VMM/VMMAll
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp
r70948 r72065 2568 2568 Assert(pCtx->hwvirt.fGif); 2569 2569 2570 if (!pCtx->hwvirt.svm.fHMCachedVmcb) 2571 { 2572 PCSVMVMCBCTRL pVmcbCtrl = &pCtx->hwvirt.svm.CTX_SUFF(pVmcb)->ctrl; 2573 X86EFLAGS fEFlags; 2574 if (pVmcbCtrl->IntCtrl.n.u1VIntrMasking) 2575 fEFlags.u = pCtx->hwvirt.svm.HostState.rflags.u; 2576 else 2577 fEFlags.u = pCtx->eflags.u; 2578 2579 return fEFlags.Bits.u1IF; 2580 } 2581 2582 return HMCanSvmNstGstTakePhysIntr(pVCpu, pCtx); 2570 X86EFLAGS fEFlags; 2571 if (CPUMIsGuestSvmVirtIntrMasking(pVCpu, pCtx)) 2572 fEFlags.u = pCtx->hwvirt.svm.HostState.rflags.u; 2573 else 2574 fEFlags.u = pCtx->eflags.u; 2575 2576 return fEFlags.Bits.u1IF; 2583 2577 #endif 2584 2578 } … … 2604 2598 Assert(pCtx->hwvirt.fGif); 2605 2599 2606 /* 2607 * Although at present, the V_TPR and V_INTR_PRIO fields are not modified 2608 * by SVM R0 code and we could inspect them directly here, we play it 2609 * safe and ask HM if it has cached the VMCB. 2610 */ 2611 if (!pCtx->hwvirt.svm.fHMCachedVmcb) 2612 { 2613 PCSVMVMCBCTRL pVmcbCtrl = &pCtx->hwvirt.svm.CTX_SUFF(pVmcb)->ctrl; 2614 if ( !pVmcbCtrl->IntCtrl.n.u1IgnoreTPR 2615 && pVmcbCtrl->IntCtrl.n.u4VIntrPrio <= pVmcbCtrl->IntCtrl.n.u8VTPR) 2616 return false; 2617 2618 X86EFLAGS fEFlags; 2619 if (pVmcbCtrl->IntCtrl.n.u1VIntrMasking) 2620 fEFlags.u = pCtx->eflags.u; 2621 else 2622 fEFlags.u = pCtx->hwvirt.svm.HostState.rflags.u; 2623 2624 return fEFlags.Bits.u1IF; 2625 } 2626 2627 return HMCanSvmNstGstTakeVirtIntr(pVCpu, pCtx); 2600 PCSVMVMCBCTRL pVmcbCtrl = &pCtx->hwvirt.svm.CTX_SUFF(pVmcb)->ctrl; 2601 PCSVMINTCTRL pVmcbIntCtrl = &pVmcbCtrl->IntCtrl; 2602 if ( !pVmcbIntCtrl->n.u1IgnoreTPR 2603 && pVmcbIntCtrl->n.u4VIntrPrio <= pVmcbIntCtrl->n.u8VTPR) 2604 return false; 2605 2606 X86EFLAGS fEFlags; 2607 if (CPUMIsGuestSvmVirtIntrMasking(pVCpu, pCtx)) 2608 fEFlags.u = pCtx->eflags.u; 2609 else 2610 fEFlags.u = pCtx->hwvirt.svm.HostState.rflags.u; 2611 2612 return fEFlags.Bits.u1IF; 2628 2613 #endif 2629 2614 } … … 2644 2629 PCSVMVMCBCTRL pVmcbCtrl = &pCtx->hwvirt.svm.CTX_SUFF(pVmcb)->ctrl; 2645 2630 return pVmcbCtrl->IntCtrl.n.u8VIntrVector; 2631 #endif 2632 } 2633 2634 2635 /** 2636 * Gets the SVM nested-guest virtual GIF. 2637 * 2638 * @returns The nested-guest virtual GIF. 2639 * @param pCtx The guest-CPU context. 2640 */ 2641 VMM_INT_DECL(bool) CPUMGetSvmNstGstVGif(PCCPUMCTX pCtx) 2642 { 2643 #ifdef IN_RC 2644 RT_NOREF(pCtx); 2645 AssertReleaseFailedReturn(false); 2646 #else 2647 PCSVMVMCBCTRL pVmcbCtrl = &pCtx->hwvirt.svm.CTX_SUFF(pVmcb)->ctrl; 2648 PCSVMINTCTRL pVmcbIntCtrl = &pVmcbCtrl->IntCtrl; 2649 if (pVmcbIntCtrl->n.u1VGifEnable) 2650 return pVmcbIntCtrl->n.u1VGif; 2651 return true; 2646 2652 #endif 2647 2653 } -
trunk/src/VBox/VMM/VMMAll/HMSVMAll.cpp
r71966 r72065 577 577 } 578 578 579 580 /**581 * Checks whether the SVM nested-guest is in a state to receive physical (APIC)582 * interrupts.583 *584 * @returns true if it's ready, false otherwise.585 * @param pVCpu The cross context virtual CPU structure of the calling EMT.586 * @param pCtx The guest-CPU context.587 *588 * @remarks This function looks at the VMCB cache rather than directly at the589 * nested-guest VMCB. The latter may have been modified for executing590 * using hardware-assisted SVM.591 *592 * @sa CPUMCanSvmNstGstTakePhysIntr.593 */594 VMM_INT_DECL(bool) HMCanSvmNstGstTakePhysIntr(PVMCPU pVCpu, PCCPUMCTX pCtx)595 {596 Assert(pCtx->hwvirt.svm.fHMCachedVmcb);597 Assert(pCtx->hwvirt.fGif);598 PCSVMNESTEDVMCBCACHE pVmcbNstGstCache = &pVCpu->hm.s.svm.NstGstVmcbCache;599 X86EFLAGS fEFlags;600 if (pVmcbNstGstCache->fVIntrMasking)601 fEFlags.u = pCtx->hwvirt.svm.HostState.rflags.u;602 else603 fEFlags.u = pCtx->eflags.u;604 return fEFlags.Bits.u1IF;605 }606 607 608 /**609 * Checks whether the SVM nested-guest is in a state to receive virtual (setup610 * for injection by VMRUN instruction) interrupts.611 *612 * @returns true if it's ready, false otherwise.613 * @param pVCpu The cross context virtual CPU structure of the calling EMT.614 * @param pCtx The guest-CPU context.615 *616 * @remarks This function looks at the VMCB cache rather than directly at the617 * nested-guest VMCB. The latter may have been modified for executing618 * using hardware-assisted SVM.619 *620 * @sa CPUMCanSvmNstGstTakeVirtIntr.621 */622 VMM_INT_DECL(bool) HMCanSvmNstGstTakeVirtIntr(PVMCPU pVCpu, PCCPUMCTX pCtx)623 {624 #ifdef IN_RC625 RT_NOREF2(pVCpu, pCtx);626 AssertReleaseFailedReturn(false);627 #else628 Assert(pCtx->hwvirt.svm.fHMCachedVmcb);629 Assert(pCtx->hwvirt.fGif);630 PCSVMNESTEDVMCBCACHE pVmcbNstGstCache = &pVCpu->hm.s.svm.NstGstVmcbCache;631 632 PCSVMVMCBCTRL pVmcbCtrl = &pCtx->hwvirt.svm.CTX_SUFF(pVmcb)->ctrl;633 if ( !pVmcbCtrl->IntCtrl.n.u1IgnoreTPR634 && pVmcbCtrl->IntCtrl.n.u4VIntrPrio <= pVmcbCtrl->IntCtrl.n.u8VTPR)635 return false;636 637 X86EFLAGS fEFlags;638 if (pVmcbNstGstCache->fVIntrMasking)639 fEFlags.u = pCtx->eflags.u;640 else641 fEFlags.u = pCtx->hwvirt.svm.HostState.rflags.u;642 return fEFlags.Bits.u1IF;643 #endif644 }645 -
trunk/src/VBox/VMM/VMMAll/IEMAllCImplSvmInstr.cpp.h
r71970 r72065 174 174 * 175 175 * - V_IRQ: Tracked using VMCPU_FF_INTERRUPT_NESTED_GUEST force-flag and updated below. 176 * - V_TPR: Already updated by iemCImpl_load_CrX or by the physical CPU for177 * hardware-assistedSVM execution.176 * - V_TPR: Updated by iemCImpl_load_CrX or by the physical CPU for hardware-assisted 177 * SVM execution. 178 178 * - Interrupt shadow: Tracked using VMCPU_FF_INHIBIT_INTERRUPTS and RIP. 179 179 */ 180 180 PSVMVMCBCTRL pVmcbMemCtrl = &pVmcbMem->ctrl; 181 if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INTERRUPT_NESTED_GUEST)) /* V_IRQ. */ 181 if (!VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INTERRUPT_NESTED_GUEST)) /* V_IRQ. */ 182 pVmcbMemCtrl->IntCtrl.n.u1VIrqPending = 0; 183 else 182 184 { 183 185 Assert(pVmcbCtrl->IntCtrl.n.u1VIrqPending); 184 pVmcbMemCtrl->IntCtrl.n.u1VIrqPending = 1;185 186 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_NESTED_GUEST); 186 187 } 187 else188 pVmcbMemCtrl->IntCtrl.n.u1VIrqPending = 0;189 188 190 189 pVmcbMemCtrl->IntCtrl.n.u8VTPR = pVmcbCtrl->IntCtrl.n.u8VTPR; /* V_TPR. */ … … 439 438 440 439 /* Virtual GIF. */ 441 if ( pVmcbCtrl->IntCtrl.n.u1VGifEnable442 && pVM->cpum.ro.GuestFeatures.fSvmVGif)440 if ( pVmcbCtrl->IntCtrl.n.u1VGifEnable 441 && !pVM->cpum.ro.GuestFeatures.fSvmVGif) 443 442 { 444 443 Log(("iemSvmVmrun: Virtual GIF not supported -> Disabling\n"));
Note:
See TracChangeset
for help on using the changeset viewer.