VirtualBox

Changeset 48194 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 30, 2013 2:33:38 PM (11 years ago)
Author:
vboxsync
Message:

VMM/HMVMXR0: Even without preemption hooks, we can now load the guest-state before disabling interrupts.
Better handling of triple faults conditions (don't leave with interrupts disabled).

File:
1 edited

Legend:

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

    r48174 r48194  
    72097209DECLINLINE(void) hmR0VmxLoadGuestStateOptimal(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    72107210{
     7211    HMVMX_ASSERT_PREEMPT_SAFE();
     7212
    72117213    Log5(("LoadFlags=%#RX32\n", pVCpu->hm.s.fContextUseFlags));
    72127214#ifdef HMVMX_SYNC_FULL_GUEST_STATE
     
    73037305#endif /* !IEM_VERIFICATION_MODE_FULL */
    73047306
    7305     /*
    7306      * When thread-context hooks are used, load the required guest-state bits here
    7307      * before we go ahead and disable interrupts. We can handle getting preempted
    7308      * while loading the guest state.
    7309      */
    7310     if (VMMR0ThreadCtxHooksAreRegistered(pVCpu))
    7311         hmR0VmxLoadGuestStateOptimal(pVM, pVCpu, pMixedCtx);
     7307    /* Load the guest state bits, we can handle longjmps/getting preempted here. */
     7308    hmR0VmxLoadGuestStateOptimal(pVM, pVCpu, pMixedCtx);
    73127309
    73137310    /*
     
    73457342    }
    73467343
    7347     /* Indicate the start of guest execution. No more longjmps or returns to ring-3 from this point!!! */
    7348     VMCPU_ASSERT_STATE(pVCpu, VMCPUSTATE_STARTED_HM);
    7349     VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED_EXEC);
    7350 
    73517344    /*
     7345     * No more longjmps or returns to ring-3 (that can continue guest execution) from this point!!!
     7346     *
    73527347     * Event injection might result in triple-faulting the VM (real-on-v86 case), which is why it's
    73537348     * done here and not in hmR0VmxPreRunGuestCommitted() which doesn't expect failures.
    73547349     */
    73557350    rc = hmR0VmxInjectPendingEvent(pVCpu, pMixedCtx);
     7351    if (RT_UNLIKELY(rc != VINF_SUCCESS))
     7352        ASMSetFlags(pVmxTransient->uEflags);
    73567353    return rc;
    73577354}
     
    73797376    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
    73807377
     7378    VMCPU_ASSERT_STATE(pVCpu, VMCPUSTATE_STARTED_HM);
     7379    VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED_EXEC);            /* Indicate the start of guest execution. */
     7380
    73817381    /*
    73827382     * Load the host state bits as we may've been preempted (only happens when
     
    73927392
    73937393    /*
    7394      * When thread-context hooks are -not- used we need to load the required
    7395      * guest state bits here i.e. when we can no longer be rescheduled.
     7394     * If we are injecting events to a real-on-v86 mode guest, we may have to update
     7395     * RIP and some other registers, i.e. hmR0VmxInjectPendingEvent()->hmR0VmxInjectEventVmcs().
     7396     * Reload only the necessary state, the assertion will catch if other parts of the code
     7397     * change.
    73967398     */
    7397     if (!VMMR0ThreadCtxHooksAreRegistered(pVCpu))
    7398         hmR0VmxLoadGuestStateOptimal(pVM, pVCpu, pMixedCtx);
    7399     else
    7400     {
    7401         /*
    7402          * If we are injecting events to a real-on-v86 mode guest, we may have to update
    7403          * RIP and some other registers, i.e. hmR0VmxInjectPendingEvent()->hmR0VmxInjectEventVmcs().
    7404          * Reload only the necessary state, the assertion will catch if other parts of the code
    7405          * change.
    7406          */
    7407         if (pVCpu->hm.s.vmx.RealMode.fRealOnV86Active)
    7408         {
    7409             hmR0VmxLoadGuestRipRspRflags(pVCpu, pMixedCtx);
    7410             hmR0VmxLoadGuestSegmentRegs(pVCpu, pMixedCtx);
    7411         }
     7399    if (pVCpu->hm.s.vmx.RealMode.fRealOnV86Active)
     7400    {
     7401        hmR0VmxLoadGuestRipRspRflags(pVCpu, pMixedCtx);
     7402        hmR0VmxLoadGuestSegmentRegs(pVCpu, pMixedCtx);
    74127403    }
    74137404
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