VirtualBox

Ignore:
Timestamp:
Jan 27, 2010 10:20:01 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
56981
Message:

Handle pending pgm sync operations in the main execution loop (vt-x/amd-v)

File:
1 edited

Legend:

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

    r26018 r26062  
    10261026
    10271027    /* Check for pending actions that force us to go back to ring 3. */
     1028    if (    VM_FF_ISPENDING(pVM, VM_FF_HWACCM_TO_R3_MASK | VM_FF_REQUEST)
     1029        ||  VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_HWACCM_TO_R3_MASK | VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL | VMCPU_FF_REQUEST))
     1030    {
     1031        /* Check if a sync operation is pending. */
     1032        if (VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL))
     1033        {
     1034            rc = PGMSyncCR3(pVCpu, pCtx->cr0, pCtx->cr3, pCtx->cr4, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3));
     1035            AssertRC(rc);
     1036            if (rc != VINF_SUCCESS)
     1037            {
     1038                Log(("Pending pool sync is forcing us back to ring 3; rc=%d\n", rc));
     1039                goto end;
     1040            }
     1041        }
     1042
    10281043#ifdef DEBUG
    1029     /* Intercept X86_XCPT_DB if stepping is enabled */
    1030     if (!DBGFIsStepping(pVCpu))
    1031 #endif
    1032     {
    1033         if (    VM_FF_ISPENDING(pVM, VM_FF_HWACCM_TO_R3_MASK)
    1034             ||  VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_HWACCM_TO_R3_MASK))
    1035         {
    1036             VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_TO_R3);
    1037             STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatSwitchToR3);
     1044        /* Intercept X86_XCPT_DB if stepping is enabled */
     1045        if (!DBGFIsStepping(pVCpu))
     1046#endif
     1047        {
     1048            if (    VM_FF_ISPENDING(pVM, VM_FF_HWACCM_TO_R3_MASK)
     1049                ||  VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_HWACCM_TO_R3_MASK))
     1050            {
     1051                VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_TO_R3);
     1052                STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatSwitchToR3);
     1053                STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x);
     1054                rc = RT_UNLIKELY(VM_FF_ISPENDING(pVM, VM_FF_PGM_NO_MEMORY)) ? VINF_EM_NO_MEMORY : VINF_EM_RAW_TO_R3;
     1055                goto end;
     1056            }
     1057        }
     1058
     1059        /* Pending request packets might contain actions that need immediate attention, such as pending hardware interrupts. */
     1060        if (    VM_FF_ISPENDING(pVM, VM_FF_REQUEST)
     1061            ||  VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_REQUEST))
     1062        {
    10381063            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x);
    1039             rc = RT_UNLIKELY(VM_FF_ISPENDING(pVM, VM_FF_PGM_NO_MEMORY)) ? VINF_EM_NO_MEMORY : VINF_EM_RAW_TO_R3;
     1064            rc = VINF_EM_PENDING_REQUEST;
    10401065            goto end;
    10411066        }
    1042     }
    1043 
    1044     /* Pending request packets might contain actions that need immediate attention, such as pending hardware interrupts. */
    1045     if (    VM_FF_ISPENDING(pVM, VM_FF_REQUEST)
    1046         ||  VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_REQUEST))
    1047     {
    1048         STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatEntry, x);
    1049         rc = VINF_EM_PENDING_REQUEST;
    1050         goto end;
    10511067    }
    10521068
     
    17131729                TRPMResetTrap(pVCpu);
    17141730                STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit1, x);
    1715 
    1716                 /* Check if a sync operation is pending. */
    1717                 if (VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL))
    1718                 {
    1719                     rc = PGMSyncCR3(pVCpu, pCtx->cr0, pCtx->cr3, pCtx->cr4, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3));
    1720                     AssertRC(rc);
    1721                     if (rc != VINF_SUCCESS)
    1722                     {
    1723                         Log(("Pending pool sync is forcing us back to ring 3; rc=%d\n", rc));
    1724                         break;
    1725                     }
    1726                 }                   
    1727 
    17281731                goto ResumeExecution;
    17291732            }
     
    18971900            TRPMResetTrap(pVCpu);
    18981901
    1899             Assert(!VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL));
    1900 
    19011902            STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit1, x);
    19021903            goto ResumeExecution;
     
    20482049        default:
    20492050            AssertFailed();
    2050         }
    2051         /* Check if a sync operation is pending. */
    2052         if (    rc == VINF_SUCCESS /* don't bother if we are going to ring 3 anyway */
    2053             &&  VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL))
    2054         {
    2055             rc = PGMSyncCR3(pVCpu, pCtx->cr0, pCtx->cr3, pCtx->cr4, VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3));
    2056             AssertRC(rc);
    2057 
    2058             STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatFlushTLBCRxChange);
    2059 
    2060             /* Must be set by PGMSyncCR3 */
    2061             AssertMsg(rc == VINF_SUCCESS || rc == VINF_PGM_SYNC_CR3 || PGMGetGuestMode(pVCpu) <= PGMMODE_PROTECTED || pVCpu->hwaccm.s.fForceTLBFlush,
    2062                       ("rc=%Rrc mode=%d fForceTLBFlush=%RTbool\n", rc, PGMGetGuestMode(pVCpu), pVCpu->hwaccm.s.fForceTLBFlush));
    20632051        }
    20642052        if (rc == VINF_SUCCESS)
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