Changeset 66994 in vbox for trunk/src/VBox
- Timestamp:
- May 22, 2017 5:37:51 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/EM.cpp
r66227 r66994 1953 1953 bool fWakeupPending = false; 1954 1954 if ( !VM_FF_IS_PENDING(pVM, VM_FF_PGM_NO_MEMORY) 1955 && !VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS) 1956 && (!rc || rc >= VINF_EM_RESCHEDULE_HM) 1957 && !TRPMHasTrap(pVCpu) /* an interrupt could already be scheduled for dispatching in the recompiler. */ 1955 && (!rc || rc >= VINF_EM_RESCHEDULE_HM)) 1956 { 1957 if ( !VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS) 1958 && !TRPMHasTrap(pVCpu) /* an interrupt could already be scheduled for dispatching in the recompiler. */ 1958 1959 #ifdef VBOX_WITH_RAW_MODE 1959 && PATMAreInterruptsEnabled(pVM)1960 && PATMAreInterruptsEnabled(pVM) 1960 1961 #else 1961 && (pVCpu->em.s.pCtx->eflags.u32 & X86_EFL_IF) 1962 #endif 1963 /** @todo Ask CPUM about nested hw.virt interrupt pending */) 1964 { 1965 Assert(!HMR3IsEventPending(pVCpu)); 1966 Assert(pVCpu->em.s.enmState != EMSTATE_WAIT_SIPI); 1967 if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC)) 1962 && (pVCpu->em.s.pCtx->eflags.u32 & X86_EFL_IF) 1963 #endif 1964 #ifdef VBOX_WITH_NESTED_HWVIRT 1965 && pVCpu->em.s.pCtx->hwvirt.svm.fGif 1966 #endif 1967 ) 1968 1968 { 1969 /* Note: it's important to make sure the return code from TRPMR3InjectEvent isn't ignored! */ 1970 /** @todo this really isn't nice, should properly handle this */ 1971 rc2 = TRPMR3InjectEvent(pVM, pVCpu, TRPM_HARDWARE_INT); 1972 if (pVM->em.s.fIemExecutesAll && (rc2 == VINF_EM_RESCHEDULE_REM || rc2 == VINF_EM_RESCHEDULE_HM || rc2 == VINF_EM_RESCHEDULE_RAW)) 1973 rc2 = VINF_EM_RESCHEDULE; 1969 Assert(!HMR3IsEventPending(pVCpu)); 1970 Assert(pVCpu->em.s.enmState != EMSTATE_WAIT_SIPI); 1971 if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC)) 1972 { 1973 #ifdef VBOX_WITH_NESTED_HWVIRT 1974 PCPUMCTX pCtx = pVCpu->em.s.pCtx; 1975 if (CPUMIsGuestSvmCtrlInterceptSet(pCtx, SVM_CTRL_INTERCEPT_INTR)) 1976 { 1977 VBOXSTRICTRC rcStrict = HMSvmNstGstVmExit(pVCpu, pCtx, SVM_EXIT_INTR, 0 /* uExitInfo1 */, 0 /* uExitInfo2 */); 1978 if (rcStrict == VINF_SVM_VMEXIT) 1979 rc2 = VINF_EM_RESCHEDULE; 1980 else 1981 { 1982 Log(("EM: SVM Nested-guest INTR #VMEXIT failed! rc=%Rrc\n", VBOXSTRICTRC_VAL(rcStrict))); 1983 /** @todo should we call iemInitiateCpuShutdown? Should this 1984 * result in trapping triple-fault intercepts? */ 1985 rc2 = VINF_EM_TRIPLE_FAULT; 1986 } 1987 } 1988 else 1989 #endif 1990 { 1991 /* Note: it's important to make sure the return code from TRPMR3InjectEvent isn't ignored! */ 1992 /** @todo this really isn't nice, should properly handle this */ 1993 rc2 = TRPMR3InjectEvent(pVM, pVCpu, TRPM_HARDWARE_INT); 1994 if (pVM->em.s.fIemExecutesAll && (rc2 == VINF_EM_RESCHEDULE_REM || rc2 == VINF_EM_RESCHEDULE_HM || rc2 == VINF_EM_RESCHEDULE_RAW)) 1995 rc2 = VINF_EM_RESCHEDULE; 1974 1996 #ifdef VBOX_STRICT 1975 rcIrq = rc2; 1976 #endif 1977 UPDATE_RC(); 1978 /* Reschedule required: We must not miss the wakeup below! */ 1979 fWakeupPending = true; 1997 rcIrq = rc2; 1998 #endif 1999 } 2000 UPDATE_RC(); 2001 /* Reschedule required: We must not miss the wakeup below! */ 2002 fWakeupPending = true; 2003 } 2004 #ifdef VBOX_WITH_NESTED_HWVIRT 2005 else if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INTERRUPT_NESTED_GUEST)) 2006 { 2007 PCPUMCTX pCtx = pVCpu->em.s.pCtx; 2008 if (HMSvmNstGstCanTakeInterrupt(pVCpu, pCtx)) 2009 { 2010 /* 2011 * Check nested-guest virtual interrupts. 2012 */ 2013 if (CPUMIsGuestSvmCtrlInterceptSet(pCtx, SVM_CTRL_INTERCEPT_VINTR)) 2014 { 2015 VBOXSTRICTRC rcStrict = HMSvmNstGstVmExit(pVCpu, pCtx, SVM_EXIT_VINTR, 0 /* uExitInfo1 */, 0 /* uExitInfo2 */); 2016 if (rcStrict == VINF_SVM_VMEXIT) 2017 rc2 = VINF_EM_RESCHEDULE; 2018 else 2019 { 2020 Log(("EM: SVM Nested-guest VINTR #VMEXIT failed! rc=%Rrc\n", VBOXSTRICTRC_VAL(rcStrict))); 2021 /** @todo should we call iemInitiateCpuShutdown? Should this 2022 * result in trapping triple-fault intercepts? */ 2023 rc2 = VINF_EM_TRIPLE_FAULT; 2024 } 2025 } 2026 else 2027 { 2028 /* 2029 * Prepare the nested-guest interrupt for injection. 2030 */ 2031 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_NESTED_GUEST); 2032 uint8_t uNstGstVector = HMSvmNstGstGetInterrupt(pCtx); 2033 TRPMAssertTrap(pVCpu, uNstGstVector, TRPM_HARDWARE_INT); 2034 /** @todo reschedule to HM/REM later, when the HMR0 nested-guest execution is 2035 * done. For now just reschedule to IEM. */ 2036 rc2 = VINF_EM_RESCHEDULE; 2037 } 2038 UPDATE_RC(); 2039 /* Reschedule required: We must not miss the wakeup below! */ 2040 fWakeupPending = true; 2041 } 2042 } 2043 #endif /* VBOX_WITH_NESTED_HWVIRT */ 1980 2044 } 1981 2045 }
Note:
See TracChangeset
for help on using the changeset viewer.