VirtualBox

Changeset 30241 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Jun 16, 2010 12:33:44 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
62736
Message:

VMMGetCpu was completely broken in the context of GMMR0CheckSharedModules

File:
1 edited

Legend:

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

    r30160 r30241  
    5959    if (pVM->cCpus == 1)
    6060        return 0;
    61     return HWACCMR0GetVMCPUId(pVM);
     61
     62    /* RTMpCpuId had better be cheap. */
     63    RTCPUID idHostCpu = RTMpCpuId();
     64
     65    /** @todo optimize for large number of VCPUs when that becomes more common. */
     66    for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
     67    {
     68        PVMCPU pVCpu = &pVM->aCpus[idCpu];
     69
     70        if (pVCpu->idHostCpu == idHostCpu)
     71            return pVCpu->idCpu;
     72    }
     73    return NIL_VMCPUID;
    6274
    6375#else /* RC: Always EMT(0) */
     
    8698    if (pVM->cCpus == 1)
    8799        return &pVM->aCpus[0];
    88     return HWACCMR0GetVMCPU(pVM);
     100
     101    /* RTMpCpuId had better be cheap. */
     102    RTCPUID idHostCpu = RTMpCpuId();
     103
     104    /** @todo optimize for large number of VCPUs when that becomes more common. */
     105    for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
     106    {
     107        PVMCPU pVCpu = &pVM->aCpus[idCpu];
     108
     109        if (pVCpu->idHostCpu == idHostCpu)
     110            return pVCpu;
     111    }
     112    return NULL;
    89113
    90114#else /* RC: Always EMT(0) */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette