VirtualBox

Changeset 48206 in vbox


Ignore:
Timestamp:
Aug 30, 2013 5:34:16 PM (11 years ago)
Author:
vboxsync
Message:

VMM/HMSVMR0: Make the code more robust regarding longjmps in awkward places.

File:
1 edited

Legend:

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

    r48204 r48206  
    27782778
    27792779    /*
     2780     * No longjmps to ring-3 from this point on!!!
     2781     * Asserts() will still longjmp to ring-3 (but won't return), which is intentional, better than a kernel panic.
     2782     * This also disables flushing of the R0-logger instance (if any).
     2783     */
     2784    VMMRZCallRing3Disable(pVCpu);
     2785
     2786    /*
    27802787     * We disable interrupts so that we don't miss any interrupts that would flag preemption (IPI/timers etc.)
    27812788     * when thread-context hooks aren't used and we've been running with preemption disabled for a while.
     
    27922799    {
    27932800        ASMSetFlags(pSvmTransient->uEflags);
     2801        VMMRZCallRing3Enable(pVCpu);
    27942802        STAM_COUNTER_INC(&pVCpu->hm.s.StatSwitchHmToR3FF);
    27952803        return VINF_EM_RAW_TO_R3;
     
    27982806    {
    27992807        ASMSetFlags(pSvmTransient->uEflags);
     2808        VMMRZCallRing3Enable(pVCpu);
    28002809        STAM_COUNTER_INC(&pVCpu->hm.s.StatPendingHostIrq);
    28012810        return VINF_EM_RAW_INTERRUPT;
    28022811    }
    2803 
    2804     /* Indicate the start of guest execution. No more longjmps or returns to ring-3 from this point!!! */
    2805     VMCPU_ASSERT_STATE(pVCpu, VMCPUSTATE_STARTED_HM);
    2806     VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED_EXEC);
    28072812
    28082813    return VINF_SUCCESS;
     
    28272832    Assert(!VMMRZCallRing3IsEnabled(pVCpu));
    28282833    Assert(VMMR0IsLogFlushDisabled(pVCpu));
     2834    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     2835
     2836    VMCPU_ASSERT_STATE(pVCpu, VMCPUSTATE_STARTED_HM);
     2837    VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED_EXEC);            /* Indicate the start of guest execution. */
    28292838
    28302839    hmR0SvmInjectPendingEvent(pVCpu, pCtx);
     
    29492958    Assert(!(ASMGetFlags() & X86_EFL_IF));
    29502959    ASMSetFlags(pSvmTransient->uEflags);                        /* Enable interrupts. */
    2951 
    29522960    VMMRZCallRing3Enable(pVCpu);                                /* It is now safe to do longjmps to ring-3!!! */
    29532961
     
    30173025            break;
    30183026
    3019         /*
    3020          * No longjmps to ring-3 from this point on!!!
    3021          * Asserts() will still longjmp to ring-3 (but won't return), which is intentional, better than a kernel panic.
    3022          * This also disables flushing of the R0-logger instance (if any).
    3023          */
    3024         VMMRZCallRing3Disable(pVCpu);
    30253027        hmR0SvmPreRunGuestCommitted(pVM, pVCpu, pCtx, &SvmTransient);
    3026 
    30273028        rc = hmR0SvmRunGuest(pVM, pVCpu, pCtx);
    30283029
    3029         /*
    3030          * Restore any residual host-state and save any bits shared between host and guest into the guest-CPU state.
    3031          * This will also re-enable longjmps to ring-3 when it has reached a safe point!!!
    3032          */
     3030        /* Restore any residual host-state and save any bits shared between host and guest into the guest-CPU state. */
    30333031        hmR0SvmPostRunGuest(pVM, pVCpu, pCtx, &SvmTransient, rc);
     3032
    30343033        if (RT_UNLIKELY(   rc != VINF_SUCCESS                                         /* Check for VMRUN errors. */
    30353034                        || SvmTransient.u64ExitCode == (uint64_t)SVM_EXIT_INVALID))   /* Check for invalid guest-state errors. */
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