Changeset 69856 in vbox for trunk/src/VBox/VMM/VMMR0
- Timestamp:
- Nov 28, 2017 10:00:14 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r69851 r69856 9222 9222 #endif 9223 9223 ASMSetFlags(pVmxTransient->fEFlags); /* Enable interrupts. */ 9224 VMMRZCallRing3Enable(pVCpu); /* It is now safe to do longjmps to ring-3!!! */9225 9224 9226 9225 /* Save the basic VM-exit reason. Refer Intel spec. 24.9.1 "Basic VM-exit Information". */ … … 9232 9231 pVmxTransient->fVMEntryFailed = VMX_ENTRY_INTERRUPTION_INFO_IS_VALID(pVmxTransient->uEntryIntInfo); 9233 9232 9234 /* If the VMLAUNCH/VMRESUME failed, we can bail out early. This does -not- cover VMX_EXIT_ERR_*. */ 9235 if (RT_UNLIKELY(rcVMRun != VINF_SUCCESS)) 9233 if (rcVMRun == VINF_SUCCESS) 9234 { 9235 /* 9236 * Update the VM-exit history array here even if the VM-entry failed due to: 9237 * - Invalid guest state. 9238 * - MSR loading. 9239 * - Machine-check event. 9240 * 9241 * In any of the above cases we will still have a "valid" VM-exit reason 9242 * despite @a fVMEntryFailed being false. 9243 * 9244 * See Intel spec. 26.7 "VM-Entry failures during or after loading guest state". 9245 */ 9246 HMCPU_EXIT_HISTORY_ADD(pVCpu, pVmxTransient->uExitReason); 9247 9248 if (!pVmxTransient->fVMEntryFailed) 9249 { 9250 /** @todo We can optimize this by only syncing with our force-flags when 9251 * really needed and keeping the VMCS state as it is for most 9252 * VM-exits. */ 9253 /* Update the guest interruptibility-state from the VMCS. */ 9254 hmR0VmxSaveGuestIntrState(pVCpu, pMixedCtx); 9255 9256 /* 9257 * Allow longjmps to ring-3 -after- saving the guest-interruptibility state 9258 * as it's not part of hmR0VmxSaveGuestState() and thus would trigger an assertion 9259 * on the longjmp path to ring-3 while saving the (rest of) the guest state, 9260 * see @bugref{6208#c63}. 9261 */ 9262 VMMRZCallRing3Enable(pVCpu); 9263 9264 #if defined(HMVMX_ALWAYS_SYNC_FULL_GUEST_STATE) || defined(HMVMX_ALWAYS_SAVE_FULL_GUEST_STATE) 9265 rc = hmR0VmxSaveGuestState(pVCpu, pMixedCtx); 9266 AssertRC(rc); 9267 #elif defined(HMVMX_ALWAYS_SAVE_GUEST_RFLAGS) 9268 rc = hmR0VmxSaveGuestRflags(pVCpu, pMixedCtx); 9269 AssertRC(rc); 9270 #endif 9271 9272 /* 9273 * Sync the TPR shadow with our APIC state. 9274 */ 9275 if ( (pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_USE_TPR_SHADOW) 9276 && pVmxTransient->u8GuestTpr != pVCpu->hm.s.vmx.pbVirtApic[XAPIC_OFF_TPR]) 9277 { 9278 rc = APICSetTpr(pVCpu, pVCpu->hm.s.vmx.pbVirtApic[XAPIC_OFF_TPR]); 9279 AssertRC(rc); 9280 HMCPU_CF_SET(pVCpu, HM_CHANGED_VMX_GUEST_APIC_STATE); 9281 } 9282 9283 return; 9284 } 9285 } 9286 else 9236 9287 { 9237 9288 Log4(("VM-entry failure: pVCpu=%p idCpu=%RU32 rcVMRun=%Rrc fVMEntryFailed=%RTbool\n", pVCpu, pVCpu->idCpu, rcVMRun, 9238 pVmxTransient->fVMEntryFailed)); 9239 return; 9240 } 9241 9242 /* 9243 * Update the VM-exit history array here even if the VM-entry failed due to: 9244 * - Invalid guest state. 9245 * - MSR loading. 9246 * - Machine-check event. 9247 * 9248 * In any of the above cases we will still have a "valid" VM-exit reason 9249 * despite @a fVMEntryFailed being false. 9250 * 9251 * See Intel spec. 26.7 "VM-Entry failures during or after loading guest state". 9252 */ 9253 HMCPU_EXIT_HISTORY_ADD(pVCpu, pVmxTransient->uExitReason); 9254 9255 if (RT_LIKELY(!pVmxTransient->fVMEntryFailed)) 9256 { 9257 /** @todo We can optimize this by only syncing with our force-flags when 9258 * really needed and keeping the VMCS state as it is for most 9259 * VM-exits. */ 9260 /* Update the guest interruptibility-state from the VMCS. */ 9261 hmR0VmxSaveGuestIntrState(pVCpu, pMixedCtx); 9262 9263 #if defined(HMVMX_ALWAYS_SYNC_FULL_GUEST_STATE) || defined(HMVMX_ALWAYS_SAVE_FULL_GUEST_STATE) 9264 rc = hmR0VmxSaveGuestState(pVCpu, pMixedCtx); 9265 AssertRC(rc); 9266 #elif defined(HMVMX_ALWAYS_SAVE_GUEST_RFLAGS) 9267 rc = hmR0VmxSaveGuestRflags(pVCpu, pMixedCtx); 9268 AssertRC(rc); 9269 #endif 9270 9271 /* 9272 * Sync the TPR shadow with our APIC state. 9273 */ 9274 if ( (pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_USE_TPR_SHADOW) 9275 && pVmxTransient->u8GuestTpr != pVCpu->hm.s.vmx.pbVirtApic[XAPIC_OFF_TPR]) 9276 { 9277 rc = APICSetTpr(pVCpu, pVCpu->hm.s.vmx.pbVirtApic[XAPIC_OFF_TPR]); 9278 AssertRC(rc); 9279 HMCPU_CF_SET(pVCpu, HM_CHANGED_VMX_GUEST_APIC_STATE); 9280 } 9281 } 9289 pVmxTransient->fVMEntryFailed)); 9290 } 9291 9292 VMMRZCallRing3Enable(pVCpu); 9282 9293 } 9283 9294
Note:
See TracChangeset
for help on using the changeset viewer.