VirtualBox

Changeset 13517

Show
Ignore:
Timestamp:
10/23/08 10:33:55 (3 months ago)
Author:
vboxsync
Message:

Refined suspend state testing.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/include/VBox/hwaccm.h

    r13343 r13517  
    120120 * @{ 
    121121 */ 
    122 VMMR0DECL(int)  HWACCMR0SetupVM(PVM pVM); 
    123 VMMR0DECL(int)  HWACCMR0RunGuestCode(PVM pVM); 
    124 VMMR0DECL(int)  HWACCMR0Enter(PVM pVM); 
    125 VMMR0DECL(int)  HWACCMR0Leave(PVM pVM); 
    126 VMMR0DECL(int)  HWACCMR0InvalidatePage(PVM pVM, RTGCPTR GCVirt); 
    127 VMMR0DECL(int)  HWACCMR0FlushTLB(PVM pVM); 
     122VMMR0DECL(int)   HWACCMR0SetupVM(PVM pVM); 
     123VMMR0DECL(int)   HWACCMR0RunGuestCode(PVM pVM); 
     124VMMR0DECL(int)   HWACCMR0Enter(PVM pVM); 
     125VMMR0DECL(int)   HWACCMR0Leave(PVM pVM); 
     126VMMR0DECL(int)   HWACCMR0InvalidatePage(PVM pVM, RTGCPTR GCVirt); 
     127VMMR0DECL(int)   HWACCMR0FlushTLB(PVM pVM); 
     128VMMR0DECL(bool)  HWACCMR0SuspendPending(); 
    128129/** @} */ 
    129130#endif /* IN_RING0 */ 
  • trunk/src/VBox/VMM/VMMR0/HWACCMR0.cpp

    r13516 r13517  
    800800 
    801801    /* Make sure we don't touch hwaccm after we've disabled hwaccm in preparation of a suspend. */ 
    802     if (HWACCMR0Globals.fSuspended) 
    803         return VERR_HWACCM_SUSPEND_PENDING; 
     802    AssertReturn(!HWACCMR0Globals.fSuspended, VERR_HWACCM_SUSPEND_PENDING); 
    804803 
    805804    /* Terminate a VT-x or AMD-V VM. */ 
     
    819818 
    820819    /* Make sure we don't touch hwaccm after we've disabled hwaccm in preparation of a suspend. */ 
    821     if (HWACCMR0Globals.fSuspended) 
    822         return VERR_HWACCM_SUSPEND_PENDING; 
     820    AssertReturn(!HWACCMR0Globals.fSuspended, VERR_HWACCM_SUSPEND_PENDING); 
    823821 
    824822#ifdef LOG_ENABLED 
     
    844842 
    845843    /* Make sure we can't enter a session after we've disabled hwaccm in preparation of a suspend. */ 
    846     if (HWACCMR0Globals.fSuspended) 
    847         return VINF_EM_RAW_INTERRUPT; 
     844    AssertReturn(!HWACCMR0Globals.fSuspended, VERR_HWACCM_SUSPEND_PENDING); 
    848845 
    849846    rc = CPUMQueryGuestCtxPtr(pVM, &pCtx); 
     
    949946 
    950947    return HWACCMR0Globals.pfnRunGuestCode(pVM, pCtx); 
     948} 
     949 
     950/** 
     951 * Returns suspend status of the host 
     952 * 
     953 * @returns Suspend pending or not 
     954 */ 
     955VMMR0DECL(bool) HWACCMR0SuspendPending() 
     956{ 
     957    return HWACCMR0Globals.fSuspended; 
    951958} 
    952959 
  • trunk/src/VBox/VMM/VMMR0/VMMR0.cpp

    r13306 r13517  
    618618         * Disable interrupts before we do anything interesting. On Windows we avoid 
    619619         * this by having the support driver raise the IRQL before calling us, this way 
    620          * we hope to get away we page faults and later calling into the kernel. 
     620         * we hope to get away with page faults and later calling into the kernel. 
    621621         */ 
    622622        case VMMR0_DO_HWACC_RUN: 
    623623        { 
     624            int rc; 
     625 
    624626            STAM_COUNTER_INC(&pVM->vmm.s.StatRunGC); 
    625627 
     
    627629            RTCCUINTREG uFlags = ASMIntDisableFlags(); 
    628630#endif 
    629             int rc = HWACCMR0Enter(pVM); 
    630             if (VBOX_SUCCESS(rc)) 
     631            if (!HWACCMR0SuspendPending()) 
    631632            { 
    632                 rc = vmmR0CallHostSetJmp(&pVM->vmm.s.CallHostR0JmpBuf, HWACCMR0RunGuestCode, pVM); /* this may resume code. */ 
    633                 int rc2 = HWACCMR0Leave(pVM); 
    634                 AssertRC(rc2); 
     633                rc = HWACCMR0Enter(pVM); 
     634                if (VBOX_SUCCESS(rc)) 
     635                { 
     636                    rc = vmmR0CallHostSetJmp(&pVM->vmm.s.CallHostR0JmpBuf, HWACCMR0RunGuestCode, pVM); /* this may resume code. */ 
     637                    int rc2 = HWACCMR0Leave(pVM); 
     638                    AssertRC(rc2); 
     639                } 
     640            } 
     641            else 
     642            { 
     643                /* System is about to go into suspend mode; go back to ring 3. */ 
     644                rc = VINF_EM_RAW_INTERRUPT; 
    635645            } 
    636646            pVM->vmm.s.iLastGCRc = rc; 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy