~ubuntu-branches/ubuntu/trusty/virtualbox-ose/trusty

« back to all changes in this revision

Viewing changes to src/VBox/VMM/VMMR0/PGMR0DynMap.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-12-18 16:44:29 UTC
  • mfrom: (0.3.3 upstream) (0.4.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091218164429-jd34ccexpv5na11a
Tags: 3.1.2-dfsg-1ubuntu1
* Merge from Debian unstable (LP: #498219), remaining changes:
  - Disable update action
    - debian/patches/u01-disable-update-action.dpatch
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
* Fixes the following bugs:
  - Kernel module fails to build with Linux >= 2.6.32 (LP: #474625)
  - X.Org drivers need to be rebuilt against X-Server 1.7 (LP: #495935)
  - The *-source packages try to build the kernel modules even though the
    kernel headers aren't available (LP: #473334)
* Replace *-source packages with transitional packages for *-dkms.
* Adapt u01-disable-update-action.dpatch and u02-lp-integration.dpatch for
  new upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
354
354
    /*
355
355
     * Initialize the auto sets.
356
356
     */
357
 
    VMCPUID idCpu = pVM->cCPUs;
 
357
    VMCPUID idCpu = pVM->cCpus;
358
358
    AssertReturn(idCpu > 0 && idCpu <= VMM_MAX_CPU_COUNT, VERR_INTERNAL_ERROR);
359
359
    while (idCpu-- > 0)
360
360
    {
442
442
        /*
443
443
         * Clean up and check the auto sets.
444
444
         */
445
 
        VMCPUID idCpu = pVM->cCPUs;
 
445
        VMCPUID idCpu = pVM->cCpus;
446
446
        while (idCpu-- > 0)
447
447
        {
448
448
            PPGMMAPSET pSet = &pVM->aCpus[idCpu].pgm.s.AutoSet;
1287
1287
DECLINLINE(uint32_t) pgmR0DynMapPage(PPGMR0DYNMAP pThis, RTHCPHYS HCPhys, int32_t iRealCpu, PVM pVM, void **ppvPage)
1288
1288
{
1289
1289
#ifdef VBOX_WITH_STATISTICS
1290
 
    PVMCPU pVCpu = VMMGetCpu(pVM);
 
1290
    PVMCPU              pVCpu   = VMMGetCpu(pVM);
1291
1291
#endif
1292
 
    RTSPINLOCKTMP   Tmp       = RTSPINLOCKTMP_INITIALIZER;
 
1292
    RTSPINLOCKTMP       Tmp     = RTSPINLOCKTMP_INITIALIZER;
1293
1293
    RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
1294
1294
    AssertMsg(!(HCPhys & PAGE_OFFSET_MASK), ("HCPhys=%RHp\n", HCPhys));
1295
1295
    STAM_COUNTER_INC(&pVCpu->pgm.s.StatR0DynMapPage);
1389
1389
    /*
1390
1390
     * Basic pool stuff that doesn't require any lock, just assumes we're a user.
1391
1391
     */
1392
 
    PPGMR0DYNMAP    pThis = g_pPGMR0DynMap;
 
1392
    PPGMR0DYNMAP        pThis       = g_pPGMR0DynMap;
1393
1393
    if (!pThis)
1394
1394
        return VINF_SUCCESS;
1395
1395
    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
1398
1398
        return VERR_INVALID_PARAMETER;
1399
1399
 
1400
1400
 
1401
 
    int             rc = VINF_SUCCESS;
1402
 
    RTSPINLOCKTMP   Tmp = RTSPINLOCKTMP_INITIALIZER;
 
1401
    int                 rc          = VINF_SUCCESS;
 
1402
    RTSPINLOCKTMP       Tmp         = RTSPINLOCKTMP_INITIALIZER;
1403
1403
    RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
1404
1404
 
1405
1405
#define CHECK_RET(expr, a) \
1529
1529
    if (    cEntries != 0
1530
1530
        &&  RT_LIKELY(cEntries <= RT_ELEMENTS(pSet->aEntries)))
1531
1531
    {
1532
 
        PPGMR0DYNMAP    pThis = g_pPGMR0DynMap;
1533
 
        RTSPINLOCKTMP   Tmp = RTSPINLOCKTMP_INITIALIZER;
 
1532
        PPGMR0DYNMAP    pThis   = g_pPGMR0DynMap;
 
1533
        RTSPINLOCKTMP   Tmp     = RTSPINLOCKTMP_INITIALIZER;
1534
1534
        RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
1535
1535
 
1536
1536
        uint32_t i = cEntries;
1634
1634
            AssertMsg(i <= RT_ELEMENTS(pSet->aEntries), ("%#x (%u)\n", i, i));
1635
1635
            if (i != 0 && RT_LIKELY(i <= RT_ELEMENTS(pSet->aEntries)))
1636
1636
            {
1637
 
                PPGMR0DYNMAP    pThis = g_pPGMR0DynMap;
1638
 
                RTSPINLOCKTMP   Tmp = RTSPINLOCKTMP_INITIALIZER;
 
1637
                PPGMR0DYNMAP    pThis  = g_pPGMR0DynMap;
 
1638
                RTSPINLOCKTMP   Tmp    = RTSPINLOCKTMP_INITIALIZER;
1639
1639
                RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
1640
1640
 
1641
1641
                while (i-- > 0)
1724
1724
    PPGMMAPSET      pSet = &pVCpu->pgm.s.AutoSet;
1725
1725
    AssertReturn(pSet->cEntries != PGMMAPSET_CLOSED, UINT32_MAX);
1726
1726
    uint32_t        iPrevSubset = pSet->iSubset;
1727
 
Assert(iPrevSubset == UINT32_MAX);
1728
1727
    pSet->iSubset = pSet->cEntries;
1729
1728
    STAM_COUNTER_INC(&pVCpu->pgm.s.StatR0DynMapSubsets);
1730
1729
    return iPrevSubset;
1743
1742
    uint32_t        cEntries = pSet->cEntries;
1744
1743
    AssertReturnVoid(cEntries != PGMMAPSET_CLOSED);
1745
1744
    AssertReturnVoid(pSet->iSubset <= iPrevSubset || iPrevSubset == UINT32_MAX);
1746
 
Assert(iPrevSubset == UINT32_MAX);
1747
1745
    STAM_COUNTER_INC(&pVCpu->pgm.s.aStatR0DynMapSetSize[(cEntries * 10 / RT_ELEMENTS(pSet->aEntries)) % 11]);
1748
1746
    if (    cEntries >= RT_ELEMENTS(pSet->aEntries) * 40 / 100
1749
1747
        &&  cEntries != pSet->iSubset)