VirtualBox

Changeset 10607 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jul 14, 2008 4:17:10 PM (16 years ago)
Author:
vboxsync
Message:

Guest state loading and host state saving *must* be done after TPR handling as that code can jump back to ring 3 (!).

Location:
trunk/src/VBox/VMM/VMMR0
Files:
2 edited

Legend:

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

    r10572 r10607  
    853853    }
    854854
    855     /* Load the guest state */
    856     rc = SVMR0LoadGuestState(pVM, pCtx);
    857     if (rc != VINF_SUCCESS)
    858     {
    859         STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatEntry, x);
    860         goto end;
    861     }
    862     fGuestStateSynced = true;
    863 
    864855    /* TPR caching using CR8 is only available in 64 bits mode */
    865856    /* Note the 32 bits exception for AMD (X86_CPUID_AMD_FEATURE_ECX_CR8L), but that appears missing in Intel CPUs */
    866     /* Note: we can't do this in LoadGuestState as PDMApicGetTPR can jump back to ring 3 (lock). */
     857    /* Note: we can't do this in LoadGuestState as PDMApicGetTPR can jump back to ring 3 (lock)!!!!!!!! */
    867858    if (pCtx->msrEFER & MSR_K6_EFER_LMA)
    868859    {
     
    897888     *       (until the actual world switch)
    898889     */
     890
     891    /* Load the guest state; *must* be here as it sets up the shadow cr0 for lazy fpu syncing! */
     892    rc = SVMR0LoadGuestState(pVM, pCtx);
     893    if (rc != VINF_SUCCESS)
     894    {
     895        STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatEntry, x);
     896        goto end;
     897    }
     898    fGuestStateSynced = true;
     899
    899900    pCpu = HWACCMR0GetCurrentCpu();
    900901    /* Force a TLB flush for the first world switch if the current cpu differs from the one we ran on last. */
  • trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp

    r10572 r10607  
    11681168    /** @todo check timers?? */
    11691169
    1170     /* Save the host state first. */
    1171     rc  = VMXR0SaveHostState(pVM);
    1172     if (rc != VINF_SUCCESS)
    1173     {
    1174         STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatEntry, x);
    1175         goto end;
    1176     }
    1177     /* Load the guest state */
    1178     rc = VMXR0LoadGuestState(pVM, pCtx);
    1179     if (rc != VINF_SUCCESS)
    1180     {
    1181         STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatEntry, x);
    1182         goto end;
    1183     }
    1184     fGuestStateSynced = true;
    1185 
    11861170    /* TPR caching using CR8 is only available in 64 bits mode */
    11871171    /* Note the 32 bits exception for AMD (X86_CPUID_AMD_FEATURE_ECX_CR8L), but that appears missing in Intel CPUs */
    1188     /* Note: we can't do this in LoadGuestState as PDMApicGetTPR can jump back to ring 3 (lock). */
     1172    /* Note: we can't do this in LoadGuestState as PDMApicGetTPR can jump back to ring 3 (lock)!!!!! */
    11891173    /*
    11901174     * @todo reduce overhead
     
    12041188        AssertRC(rc);
    12051189    }
     1190
     1191    /*
     1192     * NOTE: DO NOT DO ANYTHING AFTER THIS POINT THAT MIGHT JUMP BACK TO RING 3!
     1193     *       (until the actual world switch)
     1194     */
     1195    /* Save the host state first. */
     1196    rc  = VMXR0SaveHostState(pVM);
     1197    if (rc != VINF_SUCCESS)
     1198    {
     1199        STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatEntry, x);
     1200        goto end;
     1201    }
     1202    /* Load the guest state */
     1203    rc = VMXR0LoadGuestState(pVM, pCtx);
     1204    if (rc != VINF_SUCCESS)
     1205    {
     1206        STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatEntry, x);
     1207        goto end;
     1208    }
     1209    fGuestStateSynced = true;
    12061210
    12071211    /* Non-register state Guest Context */
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