VirtualBox

Changeset 55864 in vbox for trunk


Ignore:
Timestamp:
May 14, 2015 6:44:04 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
100320
Message:

VMMR0EntryFast: Don't return with the context hook enabled when HMR0Enter() fails.

File:
1 edited

Legend:

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

    r55863 r55864  
    10461046                {
    10471047                    /*
    1048                      * Register thread-context hooks if required.
     1048                     * Enable the context switching hook.
    10491049                     */
    1050                     if (    pVCpu->vmm.s.hCtxHook != NIL_RTTHREADCTXHOOK
    1051                         && !RTThreadCtxHookIsEnabled(pVCpu->vmm.s.hCtxHook))
     1050                    if (pVCpu->vmm.s.hCtxHook != NIL_RTTHREADCTXHOOK)
    10521051                    {
    1053                         rc = RTThreadCtxHookEnable(pVCpu->vmm.s.hCtxHook);
    1054                         AssertRC(rc);
     1052                        Assert(!RTThreadCtxHookIsEnabled(pVCpu->vmm.s.hCtxHook));
     1053                        int rc2 = RTThreadCtxHookEnable(pVCpu->vmm.s.hCtxHook); AssertRC(rc2);
    10551054                    }
    10561055
     
    10901089                            rc = VERR_VMM_WRONG_HM_VMCPU_STATE;
    10911090                        }
     1091                        /** @todo Get rid of this. HM shouldn't disable the context hook. */
    10921092                        else if (RT_UNLIKELY(vmmR0ThreadCtxHookIsEnabled(pVCpu)))
    10931093                        {
    10941094                            pVM->vmm.s.szRing0AssertMsg1[0] = '\0';
    10951095                            RTStrPrintf(pVM->vmm.s.szRing0AssertMsg2, sizeof(pVM->vmm.s.szRing0AssertMsg2),
    1096                                         "Thread-context hooks still registered! VCPU=%p Id=%u rc=%d.\n", pVCpu, pVCpu->idCpu, rc);
     1096                                        "Thread-context hooks still enabled! VCPU=%p Id=%u rc=%d.\n", pVCpu, pVCpu->idCpu, rc);
    10971097                            rc = VERR_INVALID_STATE;
    10981098                        }
     
    11021102                    STAM_COUNTER_INC(&pVM->vmm.s.StatRunRC);
    11031103
    1104                     /** @todo shouldn't we disable the ctx hook here??? */
     1104                    /*
     1105                     * Invalidate the host CPU identifiers before we disable the context
     1106                     * hook / restore preemption.
     1107                     */
     1108                    pVCpu->iHostCpuSet = UINT32_MAX;
     1109                    ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
     1110
     1111                    /*
     1112                     * Disable context hooks.  Due to unresolved cleanup issues, we
     1113                     * cannot leave the hooks enabled when we return to ring-3.
     1114                     *
     1115                     * Note! At the moment HM may also have disabled the hook
     1116                     *       when we get here, but the IPRT API handles that.
     1117                     */
     1118                    if (pVCpu->vmm.s.hCtxHook != NIL_RTTHREADCTXHOOK)
     1119                    {
     1120                        ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
     1121                        RTThreadCtxHookDisable(pVCpu->vmm.s.hCtxHook);
     1122                    }
    11051123                }
    11061124                /*
     
    11081126                 */
    11091127                else
     1128                {
    11101129                    rc = VINF_EM_RAW_INTERRUPT;
    1111 
    1112                 /*
    1113                  * Invalidate the host CPU identifiers as we restore preemption.
    1114                  */
    1115                 pVCpu->iHostCpuSet = UINT32_MAX;
    1116                 ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
    1117 
     1130                    pVCpu->iHostCpuSet = UINT32_MAX;
     1131                    ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
     1132                }
     1133
     1134                /** @todo When HM stops messing with the context hook state, we'll disable
     1135                 *        preemption again before the RTThreadCtxHookDisable call. */
    11181136                if (!fPreemptRestored)
    11191137                    RTThreadPreemptRestore(&PreemptState);
Note: See TracChangeset for help on using the changeset viewer.

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