VirtualBox

Changeset 1976 in vbox for trunk


Ignore:
Timestamp:
Apr 6, 2007 4:55:59 PM (18 years ago)
Author:
vboxsync
Message:

Never inject interrupts or traps before we sync the GDT/IDT/LDT and TSS.

Location:
trunk/src/VBox/VMM
Files:
4 edited

Legend:

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

    r1913 r1976  
    373373static DECLCALLBACK(int) emR3Save(PVM pVM, PSSMHANDLE pSSM)
    374374{
     375    SSMR3PutBool(pSSM, pVM->em.s.fRawModeUsed);
     376    SSMR3PutBool(pSSM, pVM->em.s.fHwAccModeUsed);
    375377    return SSMR3PutBool(pSSM, pVM->em.s.fForceRAW);
    376378}
     
    399401     * Load the saved state.
    400402     */
    401     int rc = SSMR3GetBool(pSSM, &pVM->em.s.fForceRAW);
     403    int rc = SSMR3GetBool(pSSM, &pVM->em.s.fRawModeUsed);
     404    if (VBOX_FAILURE(rc))
     405        pVM->em.s.fRawModeUsed = false;
     406
     407    rc = SSMR3GetBool(pSSM, &pVM->em.s.fHwAccModeUsed);
     408    if (VBOX_FAILURE(rc))
     409        pVM->em.s.fHwAccModeUsed = false;
     410
     411    rc = SSMR3GetBool(pSSM, &pVM->em.s.fForceRAW);
    402412    if (VBOX_FAILURE(rc))
    403413        pVM->em.s.fForceRAW = false;
     
    24302440}
    24312441
     2442/**
     2443 * Check for pending raw actions
     2444 *
     2445 * @returns VBox status code.
     2446 * @param   pVM         The VM to operate on.
     2447 */
     2448EMR3DECL(int) EMR3CheckRawForcedActions(PVM pVM)
     2449{
     2450    int rc = VINF_SUCCESS;
     2451
     2452    /* Too early if we haven't entered raw or hw accelerated mode yet */
     2453    /** @todo fix this properly */
     2454    if (    pVM->em.s.fHwAccModeUsed
     2455        ||  pVM->em.s.fRawModeUsed)
     2456    {
     2457        rc = emR3RawForcedActions(pVM, pVM->em.s.pCtx);
     2458    }
     2459
     2460    return rc;
     2461}
     2462
    24322463
    24332464/**
     
    26282659        LogFlow(("VMMR3RawRunGC returned %Vrc\n", rc));
    26292660
     2661        /* Signal that we've used raw mode for the first time */
     2662        pVM->em.s.fRawModeUsed = true;
    26302663
    26312664        /*
     
    28392872        STAM_PROFILE_STOP(&pVM->em.s.StatHwAccExec, x);
    28402873
     2874        /* Signal that we've used hardware accelerated mode for the first time */
     2875        pVM->em.s.fHwAccModeUsed = true;
    28412876
    28422877        /*
  • trunk/src/VBox/VMM/EMInternal.h

    r686 r1976  
    4242
    4343/** The saved state version. */
    44 #define EM_SAVED_STATE_VERSION  2
     44#define EM_SAVED_STATE_VERSION  3
    4545
    4646/** Enable for tracing in raw mode.
     
    237237     * The flag is cleared upon entering emR3RawExecute() and updated in certain return paths. */
    238238    bool                    fForceRAW;
     239
     240    /* Set when raw mode was used for the first time */
     241    bool                    fRawModeUsed;
     242    /* Set when hardware accelerated mode was used for the first time */
     243    bool                    fHwAccModeUsed;
     244
    239245#ifdef DEBUG_TRACING_ENABLED
    240246    /** @see DEBUG_TRACING_ENABLED */
  • trunk/src/VBox/VMM/TRPM.cpp

    r1793 r1976  
    13211321            if (pVM->trpm.s.aGuestTrapHandler[u8Interrupt] != TRPM_INVALID_HANDLER)
    13221322            {
     1323                EMR3CheckRawForcedActions(pVM);
     1324               
    13231325                /* There's a handler -> let's execute it in raw mode */
    13241326                rc = TRPMForwardTrap(pVM, CPUMCTX2CORE(pCtx), u8Interrupt, 0, TRPM_TRAP_NO_ERRORCODE, enmEvent);
    13251327                if (rc == VINF_SUCCESS /* Don't use VBOX_SUCCESS */)
    13261328                {
     1329                    Assert(!VM_FF_ISPENDING(pVM, VM_FF_SELM_SYNC_GDT | VM_FF_SELM_SYNC_LDT | VM_FF_TRPM_SYNC_IDT | VM_FF_SELM_SYNC_TSS));
     1330
    13271331                    STAM_COUNTER_INC(&pVM->trpm.s.paStatForwardedIRQR3[u8Interrupt]);
    13281332                    return VINF_EM_RESCHEDULE_RAW;
  • trunk/src/VBox/VMM/VMMAll/TRPMAll.cpp

    r1930 r1976  
    433433
    434434        Assert(PATMAreInterruptsEnabledByCtxCore(pVM, pRegFrame));
     435        Assert(!VM_FF_ISPENDING(pVM, VM_FF_SELM_SYNC_GDT | VM_FF_SELM_SYNC_LDT | VM_FF_TRPM_SYNC_IDT | VM_FF_SELM_SYNC_TSS));
    435436
    436437        /* Get the current privilege level. */
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