VirtualBox

Changeset 43867 in vbox for trunk/src/VBox/VMM/VMMR0


Ignore:
Timestamp:
Nov 13, 2012 5:23:34 PM (12 years ago)
Author:
vboxsync
Message:

Do not inject events into VMCB in VM exit path. Fixes hangs immediately after VM reset.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp

    r43865 r43867  
    514514}
    515515
     516/**
     517 * Posts a pending event (trap or external interrupt). An injected event should only
     518 * be written to the VMCB immediately before VMRUN, otherwise we might have stale events
     519 * injected across VM resets and suchlike. See @bugref{6220}.
     520 *
     521 * @param   pVCpu       Pointer to the VMCPU.
     522 * @param   pCtx        Pointer to the guest CPU context.
     523 * @param   pIntInfo    Pointer to the SVM interrupt info.
     524 */
     525DECLINLINE(void) hmR0SvmSetPendingEvent(PVMCPU pVCpu, SVM_EVENT *pEvent)
     526{
     527#ifdef VBOX_STRICT
     528    Log(("SVM: Set pending event: intInfo=%016llx\n", pEvent->au64[0]));
     529#endif
     530
     531    /* If there's an event pending already, we're in trouble... */
     532    Assert(!pVCpu->hm.s.Event.fPending);
     533
     534    /* Set pending event state. */
     535    pVCpu->hm.s.Event.intInfo  = pEvent->au64[0];
     536    pVCpu->hm.s.Event.fPending = true;
     537}
    516538
    517539/**
     
    18731895                Event.n.u8Vector = X86_XCPT_DB;
    18741896
    1875                 hmR0SvmInjectEvent(pVCpu, pvVMCB, pCtx, &Event);
     1897                hmR0SvmSetPendingEvent(pVCpu, &Event);
    18761898                goto ResumeExecution;
    18771899            }
     
    19071929            Event.n.u8Vector = X86_XCPT_NM;
    19081930
    1909             hmR0SvmInjectEvent(pVCpu, pvVMCB, pCtx, &Event);
     1931            hmR0SvmSetPendingEvent(pVCpu, &Event);
    19101932            goto ResumeExecution;
    19111933        }
     
    19361958                Event.n.u32ErrorCode        = errCode;
    19371959
    1938                 hmR0SvmInjectEvent(pVCpu, pvVMCB, pCtx, &Event);
     1960                hmR0SvmSetPendingEvent(pVCpu, &Event);
    19391961                goto ResumeExecution;
    19401962            }
     
    20102032                Event.n.u32ErrorCode        = errCode;
    20112033
    2012                 hmR0SvmInjectEvent(pVCpu, pvVMCB, pCtx, &Event);
     2034                hmR0SvmSetPendingEvent(pVCpu, &Event);
    20132035                goto ResumeExecution;
    20142036            }
     
    20392061            Event.n.u8Vector = X86_XCPT_MF;
    20402062
    2041             hmR0SvmInjectEvent(pVCpu, pvVMCB, pCtx, &Event);
     2063            hmR0SvmSetPendingEvent(pVCpu, &Event);
    20422064            goto ResumeExecution;
    20432065        }
     
    20842106            }
    20852107            Log(("Trap %x at %04x:%RGv esi=%x\n", vector, pCtx->cs.Sel, (RTGCPTR)pCtx->rip, pCtx->esi));
    2086             hmR0SvmInjectEvent(pVCpu, pvVMCB, pCtx, &Event);
     2108            hmR0SvmSetPendingEvent(pVCpu, &Event);
    20872109            goto ResumeExecution;
    20882110        }
     
    25642586                            Event.n.u8Vector = X86_XCPT_DB;
    25652587
    2566                             hmR0SvmInjectEvent(pVCpu, pvVMCB, pCtx, &Event);
     2588                            hmR0SvmSetPendingEvent(pVCpu, &Event);
    25672589                            goto ResumeExecution;
    25682590                        }
     
    26652687
    26662688        Log(("Forced #UD trap at %RGv\n", (RTGCPTR)pCtx->rip));
    2667         hmR0SvmInjectEvent(pVCpu, pvVMCB, pCtx, &Event);
     2689        hmR0SvmSetPendingEvent(pVCpu, &Event);
    26682690        goto ResumeExecution;
    26692691    }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette