VirtualBox

Changeset 19593 in vbox for trunk


Ignore:
Timestamp:
May 12, 2009 7:56:07 AM (16 years ago)
Author:
vboxsync
Message:

Split up PDM.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/pdmcritsect.h

    r19589 r19593  
    7272VMMR3DECL(int)  PDMR3CritSectDelete(PPDMCRITSECT pCritSect);
    7373VMMDECL(int)    PDMR3CritSectTerm(PVM pVM);
    74 VMMR3DECL(void) PDMR3CritSectFF(PVM pVM);
     74VMMR3DECL(void) PDMR3CritSectFF(PVMCPU pVCpu);
    7575VMMR3DECL(uint32_t) PDMR3CritSectCountOwned(PVM pVM, char *pszNames, size_t cbNames);
    7676
  • trunk/include/VBox/vm.h

    r19482 r19593  
    181181        char                padding[256];       /* multiple of 64 */
    182182    } vmm;
     183
     184    /** PDM part. */
     185    union
     186    {
     187#ifdef ___PDMInternal_h
     188        struct PDMCPU       s;
     189#endif
     190        char                padding[128];       /* multiple of 64 */
     191    } pdm;
    183192
    184193    /** DBGF part.
     
    240249#define VM_FF_PDM_DMA_BIT                   4
    241250#define VM_FF_PDM_DMA                       RT_BIT_32(VM_FF_PDM_DMA_BIT)
    242 /** PDM critical section unlocking is pending, process promptly upon return to R3. */
    243 #define VM_FF_PDM_CRITSECT                  RT_BIT_32(5)
    244251/** This action forces the VM to call DBGF so DBGF can service debugger
    245252 * requests in the emulation thread.
     
    273280/** This action forces the VM to schedule and run pending timer (TM). (bogus for now; needed for PATM backwards compatibility) */
    274281#define VMCPU_FF_TIMER                      RT_BIT_32(2)
     282/** PDM critical section unlocking is pending, process promptly upon return to R3. */
     283#define VMCPU_FF_PDM_CRITSECT               RT_BIT_32(5)
    275284/** This action forces the VM to service pending requests from other
    276285 * thread or requests which must be executed in another context. */
     
    325334
    326335/** High priority post-execution actions. */
    327 #define VM_FF_HIGH_PRIORITY_POST_MASK           (VM_FF_PDM_CRITSECT | VM_FF_PGM_NO_MEMORY)
     336#define VM_FF_HIGH_PRIORITY_POST_MASK           (VM_FF_PGM_NO_MEMORY)
    328337/** High priority post-execution actions. */
    329 #define VMCPU_FF_HIGH_PRIORITY_POST_MASK        (VMCPU_FF_CSAM_PENDING_ACTION)
     338#define VMCPU_FF_HIGH_PRIORITY_POST_MASK        (VMCPU_FF_PDM_CRITSECT|VMCPU_FF_CSAM_PENDING_ACTION)
    330339
    331340/** Normal priority VM post-execution actions. */
     
    353362
    354363/** All the forced VM flags. */
    355 #define VM_FF_ALL_BUT_RAW_MASK                  (~(VM_FF_HIGH_PRIORITY_PRE_RAW_MASK | VM_FF_PDM_CRITSECT) | VM_FF_PGM_NO_MEMORY)
     364#define VM_FF_ALL_BUT_RAW_MASK                  (~(VM_FF_HIGH_PRIORITY_PRE_RAW_MASK) | VM_FF_PGM_NO_MEMORY)
    356365/** All the forced VMCPU flags. */
    357 #define VMCPU_FF_ALL_BUT_RAW_MASK               (~(VMCPU_FF_HIGH_PRIORITY_PRE_RAW_MASK | VMCPU_FF_CSAM_PENDING_ACTION))
     366#define VMCPU_FF_ALL_BUT_RAW_MASK               (~(VMCPU_FF_HIGH_PRIORITY_PRE_RAW_MASK | VMCPU_FF_CSAM_PENDING_ACTION | VMCPU_FF_PDM_CRITSECT))
    358367
    359368/** @} */
  • trunk/src/VBox/VMM/EM.cpp

    r19481 r19593  
    32563256static int emR3HighPriorityPostForcedActions(PVM pVM, PVMCPU pVCpu, int rc)
    32573257{
    3258     if (VM_FF_ISPENDING(pVM, VM_FF_PDM_CRITSECT))
    3259         PDMR3CritSectFF(pVM);
     3258    if (VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_PDM_CRITSECT))
     3259        PDMR3CritSectFF(pVCpu);
    32603260
    32613261    if (VMCPU_FF_ISPENDING(pVCpu, VMCPU_FF_CSAM_PENDING_ACTION))
  • trunk/src/VBox/VMM/PDMCritSect.cpp

    r19439 r19593  
    295295 * Process the critical sections queued for ring-3 'leave'.
    296296 *
    297  * @param   pVM         The VM handle.
    298  */
    299 VMMR3DECL(void) PDMR3CritSectFF(PVM pVM)
    300 {
    301     Assert(pVM->pdm.s.cQueuedCritSectLeaves > 0);
    302 
    303     const RTUINT c = pVM->pdm.s.cQueuedCritSectLeaves;
     297 * @param   pVCpu         The VMCPU handle.
     298 */
     299VMMR3DECL(void) PDMR3CritSectFF(PVMCPU pVCpu)
     300{
     301    Assert(pVCpu->pdm.s.cQueuedCritSectLeaves > 0);
     302
     303    const RTUINT c = pVCpu->pdm.s.cQueuedCritSectLeaves;
    304304    for (RTUINT i = 0; i < c; i++)
    305305    {
    306         PPDMCRITSECT pCritSect = pVM->pdm.s.apQueuedCritSectsLeaves[i];
     306        PPDMCRITSECT pCritSect = pVCpu->pdm.s.apQueuedCritSectsLeaves[i];
    307307        int rc = RTCritSectLeave(&pCritSect->s.Core);
    308308        LogFlow(("PDMR3CritSectFF: %p - %Rrc\n", pCritSect, rc));
     
    310310    }
    311311
    312     pVM->pdm.s.cQueuedCritSectLeaves = 0;
    313     VM_FF_CLEAR(pVM, VM_FF_PDM_CRITSECT);
     312    pVCpu->pdm.s.cQueuedCritSectLeaves = 0;
     313    VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_PDM_CRITSECT);
    314314}
    315315
  • trunk/src/VBox/VMM/PDMInternal.h

    r19475 r19593  
    797797typedef struct PDMASYNCCOMPLETIONMANAGER *PPDMASYNCCOMPLETIONMANAGER;
    798798
     799
     800/**
     801 * PDM VMCPU Instance data.
     802 * Changes to this must checked against the padding of the cfgm union in VMCPU!
     803 */
     804typedef struct PDMCPU
     805{
     806    /** The number of entries in the apQueuedCritSectsLeaves table that's currnetly in use. */
     807    RTUINT                          cQueuedCritSectLeaves;
     808    RTUINT                          uPadding0; /**< Alignment padding.*/
     809    /** Critical sections queued in RC/R0 because of contention preventing leave to complete. (R3 Ptrs)
     810     * We will return to Ring-3 ASAP, so this queue doesn't have to be very long. */
     811    R3PTRTYPE(PPDMCRITSECT)         apQueuedCritSectsLeaves[8];
     812} PDMCPU;
     813
    799814/**
    800815 * Converts a PDM pointer into a VM pointer.
     
    850865    RCPTRTYPE(PPDMQUEUE)            pDevHlpQueueRC;
    851866
    852     /** The number of entries in the apQueuedCritSectsLeaves table that's currnetly in use. */
    853     RTUINT                          cQueuedCritSectLeaves;
    854     /** Critical sections queued in RC/R0 because of contention preventing leave to complete. (R3 Ptrs)
    855      * We will return to Ring-3 ASAP, so this queue doesn't have to be very long. */
    856     R3PTRTYPE(PPDMCRITSECT)         apQueuedCritSectsLeaves[8];
     867    RTUINT                          uPadding1; /**< Alignment padding. */
    857868
    858869    /** Linked list of timer driven PDM queues. */
     
    867878    RCPTRTYPE(struct PDMQUEUE *)    pQueueFlushRC;
    868879#if HC_ARCH_BITS == 64
    869     RTRCPTR                         padding0;
     880    RTRCPTR                         uPadding2;
    870881#endif
    871882
  • trunk/src/VBox/VMM/VMM.cpp

    r19582 r19593  
    16871687    PRINT_FLAG(VM_FF_,PDM_QUEUES);
    16881688    PRINT_FLAG(VM_FF_,PDM_DMA);
    1689     PRINT_FLAG(VM_FF_,PDM_CRITSECT);
    16901689    PRINT_FLAG(VM_FF_,DBGF);
    16911690    PRINT_FLAG(VM_FF_,REQUEST);
     
    17281727        PRINT_FLAG(VMCPU_FF_,INTERRUPT_APIC);
    17291728        PRINT_FLAG(VMCPU_FF_,INTERRUPT_PIC);
     1729        PRINT_FLAG(VMCPU_FF_,PDM_CRITSECT);
    17301730        PRINT_FLAG(VMCPU_FF_,PGM_SYNC_CR3);
    17311731        PRINT_FLAG(VMCPU_FF_,PGM_SYNC_CR3_NON_GLOBAL);
  • trunk/src/VBox/VMM/VMMAll/PDMAllCritSect.cpp

    r19590 r19593  
    253253     * Queue the request.
    254254     */
    255     RTUINT i = pVM->pdm.s.cQueuedCritSectLeaves++;
     255    RTUINT i = pVCpu->pdm.s.cQueuedCritSectLeaves++;
    256256    LogFlow(("PDMCritSectLeave: [%d]=%p => R3\n", i, pCritSect));
    257     AssertFatal(i < RT_ELEMENTS(pVM->pdm.s.apQueuedCritSectsLeaves));
    258     pVM->pdm.s.apQueuedCritSectsLeaves[i] = MMHyperCCToR3(pVM, pCritSect);
    259     VM_FF_SET(pVM, VM_FF_PDM_CRITSECT);
     257    AssertFatal(i < RT_ELEMENTS(pVCpu->pdm.s.apQueuedCritSectsLeaves));
     258    pVCpu->pdm.s.apQueuedCritSectsLeaves[i] = MMHyperCCToR3(pVM, pCritSect);
     259    VMCPU_FF_SET(pVCpu, VMCPU_FF_PDM_CRITSECT);
    260260    VMCPU_FF_SET(pVCpu, VMCPU_FF_TO_R3);
    261261    STAM_REL_COUNTER_INC(&pVM->pdm.s.StatQueuedCritSectLeaves);
  • trunk/src/VBox/VMM/testcase/tstVMStructGC.cpp

    r19462 r19593  
    332332    GEN_CHECK_OFF(PDM, pDevHlpQueueR0);
    333333    GEN_CHECK_OFF(PDM, pDevHlpQueueRC);
    334     GEN_CHECK_OFF(PDM, cQueuedCritSectLeaves);
    335     GEN_CHECK_OFF(PDM, apQueuedCritSectsLeaves);
     334    GEN_CHECK_OFF(PDMCPU, cQueuedCritSectLeaves);
     335    GEN_CHECK_OFF(PDMCPU, apQueuedCritSectsLeaves);
    336336    GEN_CHECK_OFF(PDM, pQueuesTimer);
    337337    GEN_CHECK_OFF(PDM, pQueuesForced);
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