diff options
author | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2023-05-09 04:17:08 +0000 |
---|---|---|
committer | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2023-05-09 04:17:08 +0000 |
commit | 088510449cb14004351aa598a6b8ca7535bddf7c (patch) | |
tree | 32d09b024f008415e48c29fc26707b0c2309cfc9 | |
parent | 08c871572ea86195640ec9c4d8a1a5493690497b (diff) | |
download | VirtualBox-svn-088510449cb14004351aa598a6b8ca7535bddf7c.tar.gz |
VMM: Nested VMX: bugref:10318 Moved vmxHCGetGuestIntrStateWithUpdate() back into vmxHCEvaluatePendingEvent[Nested] as it implicitly ensures ordering.
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@99687 cfe28804-0f27-0410-a406-dd0f0b0b656f
-rw-r--r-- | src/VBox/VMM/VMMAll/VMXAllTemplate.cpp.h | 22 | ||||
-rw-r--r-- | src/VBox/VMM/VMMR0/HMVMXR0.cpp | 8 | ||||
-rw-r--r-- | src/VBox/VMM/VMMR3/NEMR3Native-darwin.cpp | 4 |
3 files changed, 22 insertions, 12 deletions
diff --git a/src/VBox/VMM/VMMAll/VMXAllTemplate.cpp.h b/src/VBox/VMM/VMMAll/VMXAllTemplate.cpp.h index 6d100858492..5ba15efb042 100644 --- a/src/VBox/VMM/VMMAll/VMXAllTemplate.cpp.h +++ b/src/VBox/VMM/VMMAll/VMXAllTemplate.cpp.h @@ -4858,13 +4858,18 @@ static VBOXSTRICTRC vmxHCInjectEventVmcs(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo, * NOT restore these force-flags. * * @returns Strict VBox status code (i.e. informational status codes too). - * @param pVCpu The cross context virtual CPU structure. - * @param pVmcsInfo The VMCS information structure. + * @param pVCpu The cross context virtual CPU structure. + * @param pVmcsInfo The VMCS information structure. + * @param pfIntrState Where to store the updated VMX guest-interruptibility + * state. */ -static VBOXSTRICTRC vmxHCEvaluatePendingEvent(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo) +static VBOXSTRICTRC vmxHCEvaluatePendingEvent(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo, uint32_t *pfIntrState) { + Assert(pfIntrState); Assert(!TRPMHasTrap(pVCpu)); + *pfIntrState = vmxHCGetGuestIntrStateWithUpdate(pVCpu); + /* * Evaluate if a new event needs to be injected. * An event that's already pending has already performed all necessary checks. @@ -4983,18 +4988,23 @@ static VBOXSTRICTRC vmxHCEvaluatePendingEvent(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcs * NOT restore these force-flags. * * @returns Strict VBox status code (i.e. informational status codes too). - * @param pVCpu The cross context virtual CPU structure. - * @param pVmcsInfo The VMCS information structure. + * @param pVCpu The cross context virtual CPU structure. + * @param pVmcsInfo The VMCS information structure. + * @param pfIntrState Where to store the updated VMX guest-interruptibility + * state. * * @remarks The guest must be in VMX non-root mode. */ -static VBOXSTRICTRC vmxHCEvaluatePendingEventNested(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo) +static VBOXSTRICTRC vmxHCEvaluatePendingEventNested(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo, uint32_t *pfIntrState) { PCCPUMCTX pCtx = &pVCpu->cpum.GstCtx; + Assert(pfIntrState); Assert(CPUMIsGuestInVmxNonRootMode(pCtx)); Assert(!TRPMHasTrap(pVCpu)); + *pfIntrState = vmxHCGetGuestIntrStateWithUpdate(pVCpu); + /* * If we are injecting an event, all necessary checks have been performed. * Any interrupt-window or NMI-window exiting would have been setup by the diff --git a/src/VBox/VMM/VMMR0/HMVMXR0.cpp b/src/VBox/VMM/VMMR0/HMVMXR0.cpp index 12753f203ab..751ad8aeb30 100644 --- a/src/VBox/VMM/VMMR0/HMVMXR0.cpp +++ b/src/VBox/VMM/VMMR0/HMVMXR0.cpp @@ -5922,12 +5922,12 @@ static VBOXSTRICTRC hmR0VmxPreRunGuest(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransie if (TRPMHasTrap(pVCpu)) vmxHCTrpmTrapToPendingEvent(pVCpu); - uint32_t const fIntrState = vmxHCGetGuestIntrStateWithUpdate(pVCpu); + uint32_t fIntrState; #ifdef VBOX_WITH_NESTED_HWVIRT_VMX if (!pVmxTransient->fIsNestedGuest) - rcStrict = vmxHCEvaluatePendingEvent(pVCpu, pVmxTransient->pVmcsInfo); + rcStrict = vmxHCEvaluatePendingEvent(pVCpu, pVmxTransient->pVmcsInfo, &fIntrState); else - rcStrict = vmxHCEvaluatePendingEventNested(pVCpu, pVmxTransient->pVmcsInfo); + rcStrict = vmxHCEvaluatePendingEventNested(pVCpu, pVmxTransient->pVmcsInfo, &fIntrState); /* * While evaluating pending events if something failed (unlikely) or if we were @@ -5942,7 +5942,7 @@ static VBOXSTRICTRC hmR0VmxPreRunGuest(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransie return VINF_VMX_VMEXIT; } #else - rcStrict = vmxHCEvaluatePendingEvent(pVCpu, pVmxTransient->pVmcsInfo); + rcStrict = vmxHCEvaluatePendingEvent(pVCpu, pVmxTransient->pVmcsInfo, &fIntrState); Assert(rcStrict == VINF_SUCCESS); #endif diff --git a/src/VBox/VMM/VMMR3/NEMR3Native-darwin.cpp b/src/VBox/VMM/VMMR3/NEMR3Native-darwin.cpp index e5102151a72..a4922ef081b 100644 --- a/src/VBox/VMM/VMMR3/NEMR3Native-darwin.cpp +++ b/src/VBox/VMM/VMMR3/NEMR3Native-darwin.cpp @@ -3737,8 +3737,8 @@ static VBOXSTRICTRC nemR3DarwinPreRunGuest(PVM pVM, PVMCPU pVCpu, PVMXTRANSIENT if (TRPMHasTrap(pVCpu)) vmxHCTrpmTrapToPendingEvent(pVCpu); - uint32_t const fIntrState = vmxHCGetGuestIntrStateWithUpdate(pVCpu); - rcStrict = vmxHCEvaluatePendingEvent(pVCpu, &pVCpu->nem.s.VmcsInfo); + uint32_t fIntrState; + rcStrict = vmxHCEvaluatePendingEvent(pVCpu, &pVCpu->nem.s.VmcsInfo, &fIntrState); /* * Event injection may take locks (currently the PGM lock for real-on-v86 case) and thus |