VirtualBox

Changeset 7348 in vbox for trunk/src/VBox/Runtime/generic


Ignore:
Timestamp:
Mar 7, 2008 10:37:10 AM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
28767
Message:

Generic implementations of the new RTMp functions.

Location:
trunk/src/VBox/Runtime/generic
Files:
9 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/generic/RTMpCpuIdFromSetIndex-generic.cpp

    r7337 r7348  
    11/* $Id$ */
    22/** @file
    3  * innotek Portable Runtime - Multiprocessor, Generic RTMpCpuId.
     3 * innotek Portable Runtime - Multiprocessor, Generic RTMpCpuIdFromSetIndex.
    44 */
    55
     
    3030*******************************************************************************/
    3131#include <iprt/mp.h>
    32 #include <iprt/asm.h>
    3332
    3433
    35 RTDECL(RTCPUID) RTMpCpuId(void)
     34RTDECL(RTCPUID) RTMpCpuIdFromSetIndex(int iCpu)
    3635{
    37 #if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    38     return ASMGetApicId();
    39 #else
    40 # error "Not ported to this architecture."
    41     return NIL_RTAPICID;
    42 #endif
     36    return iCpu >= 0 ? iCpu : NIL_RTCPUID;
    4337}
    4438
  • trunk/src/VBox/Runtime/generic/RTMpCpuIdToSetIndex-generic.cpp

    r7337 r7348  
    11/* $Id$ */
    22/** @file
    3  * innotek Portable Runtime - Multiprocessor, Generic RTMpCpuId.
     3 * innotek Portable Runtime - Multiprocessor, Generic RTMpCpuIdToSetIndex.
    44 */
    55
     
    3030*******************************************************************************/
    3131#include <iprt/mp.h>
    32 #include <iprt/asm.h>
    3332
    3433
    35 RTDECL(RTCPUID) RTMpCpuId(void)
     34RTDECL(int) RTMpCpuIdToSetIndex(RTCPUID idCpu)
    3635{
    37 #if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    38     return ASMGetApicId();
    39 #else
    40 # error "Not ported to this architecture."
    41     return NIL_RTAPICID;
    42 #endif
     36    return idCpu != NIL_RTCPUID ? idCpu : -1;
    4337}
    4438
  • trunk/src/VBox/Runtime/generic/RTMpDoesCpuExist-generic.cpp

    r7336 r7348  
    11/* $Id$ */
    22/** @file
    3  * innotek Portable Runtime - Multiprocessor, Generic RTMpCpuId.
     3 * innotek Portable Runtime - Multiprocessor, Generic RTMpDoesCpuExist.
    44 */
    55
     
    3030*******************************************************************************/
    3131#include <iprt/mp.h>
    32 #include <iprt/asm.h>
    3332
    3433
    35 RTDECL(RTCPUID) RTMpCpuId(void)
     34RTDECL(bool) RTMpDoesCpuExist(RTCPUID idCpu)
    3635{
    37 #if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    38     return ASMGetApicId();
    39 #else
    40 # error "Not ported to this architecture."
    41     return NIL_RTAPICID;
    42 #endif
     36    return RTMpCpuId() == idCpu;
    4337}
    4438
  • trunk/src/VBox/Runtime/generic/RTMpGetCount-generic.cpp

    r7337 r7348  
    11/* $Id$ */
    22/** @file
    3  * innotek Portable Runtime - Multiprocessor, Generic RTMpCpuId.
     3 * innotek Portable Runtime - Multiprocessor, Generic RTMpGetCount.
    44 */
    55
     
    3030*******************************************************************************/
    3131#include <iprt/mp.h>
    32 #include <iprt/asm.h>
     32#include <iprt/cpuset.h>
    3333
    3434
    35 RTDECL(RTCPUID) RTMpCpuId(void)
     35RTDECL(RTCPUID) RTMpGetCount(void)
    3636{
    37 #if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    38     return ASMGetApicId();
    39 #else
    40 # error "Not ported to this architecture."
    41     return NIL_RTAPICID;
    42 #endif
     37    RTCPUSET Set;
     38    RTMpGetSet(&Set);
     39    return RTCpuSetCount(&Set);
    4340}
    4441
  • trunk/src/VBox/Runtime/generic/RTMpGetMaxCpuId-generic.cpp

    r7337 r7348  
    11/* $Id$ */
    22/** @file
    3  * innotek Portable Runtime - Multiprocessor, Generic RTMpCpuId.
     3 * innotek Portable Runtime - Multiprocessor, Generic RTMpGetMaxCpuId.
    44 */
    55
     
    3030*******************************************************************************/
    3131#include <iprt/mp.h>
    32 #include <iprt/asm.h>
    3332
    3433
    35 RTDECL(RTCPUID) RTMpCpuId(void)
     34RTDECL(RTCPUID) RTMpGetMaxCpuId(void)
    3635{
    37 #if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    38     return ASMGetApicId();
    39 #else
    40 # error "Not ported to this architecture."
    41     return NIL_RTAPICID;
    42 #endif
     36    return RTMpCpuId();
    4337}
    4438
  • trunk/src/VBox/Runtime/generic/RTMpGetOnlineCount-generic.cpp

    r7337 r7348  
    11/* $Id$ */
    22/** @file
    3  * innotek Portable Runtime - Multiprocessor, Generic RTMpCpuId.
     3 * innotek Portable Runtime - Multiprocessor, Generic RTMpGetOnlineCount.
    44 */
    55
     
    3030*******************************************************************************/
    3131#include <iprt/mp.h>
    32 #include <iprt/asm.h>
     32#include <iprt/cpuset.h>
    3333
    3434
    35 RTDECL(RTCPUID) RTMpCpuId(void)
     35RTDECL(RTCPUID) RTMpGetOnlineCount(void)
    3636{
    37 #if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    38     return ASMGetApicId();
    39 #else
    40 # error "Not ported to this architecture."
    41     return NIL_RTAPICID;
    42 #endif
     37    RTCPUSET Set;
     38    RTMpGetOnlineSet(&Set);
     39    return RTCpuSetCount(&Set);
    4340}
    4441
  • trunk/src/VBox/Runtime/generic/RTMpGetOnlineSet-generic.cpp

    r7337 r7348  
    11/* $Id$ */
    22/** @file
    3  * innotek Portable Runtime - Multiprocessor, Generic RTMpCpuId.
     3 * innotek Portable Runtime - Multiprocessor, Generic RTMpGetOnlineSet.
    44 */
    55
     
    3030*******************************************************************************/
    3131#include <iprt/mp.h>
    32 #include <iprt/asm.h>
     32#include <iprt/cpuset.h>
    3333
    3434
    35 RTDECL(RTCPUID) RTMpCpuId(void)
     35RTDECL(PRTCPUSET) RTMpGetOnlineSet(PRTCPUSET pSet)
    3636{
    37 #if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    38     return ASMGetApicId();
    39 #else
    40 # error "Not ported to this architecture."
    41     return NIL_RTAPICID;
    42 #endif
     37    RTCPUID idCpu;
     38
     39    RTCpuSetEmpty(pSet);
     40    idCpu = RTMpGetMaxCpuId();
     41    do
     42    {
     43        if (RTMpIsCpuOnline(idCpu))
     44            RTCpuSetAdd(pSet, idCpu);
     45    } while (idCpu-- > 0);
     46    return pSet;
    4347}
    4448
  • trunk/src/VBox/Runtime/generic/RTMpGetSet-generic.cpp

    r7337 r7348  
    11/* $Id$ */
    22/** @file
    3  * innotek Portable Runtime - Multiprocessor, Generic RTMpCpuId.
     3 * innotek Portable Runtime - Multiprocessor, Generic RTMpGetSet.
    44 */
    55
     
    3030*******************************************************************************/
    3131#include <iprt/mp.h>
    32 #include <iprt/asm.h>
     32#include <iprt/cpuset.h>
    3333
    3434
    35 RTDECL(RTCPUID) RTMpCpuId(void)
     35RTDECL(PRTCPUSET) RTMpGetSet(PRTCPUSET pSet)
    3636{
    37 #if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    38     return ASMGetApicId();
    39 #else
    40 # error "Not ported to this architecture."
    41     return NIL_RTAPICID;
    42 #endif
     37    RTCPUID idCpu;
     38
     39    RTCpuSetEmpty(pSet);
     40    idCpu = RTMpGetMaxCpuId();
     41    do
     42    {
     43        if (RTMpDoesCpuExist(idCpu))
     44            RTCpuSetAdd(pSet, idCpu);
     45    } while (idCpu-- > 0);
     46    return pSet;
    4347}
    4448
  • trunk/src/VBox/Runtime/generic/RTMpIsCpuOnline-generic.cpp

    r7336 r7348  
    11/* $Id$ */
    22/** @file
    3  * innotek Portable Runtime - Multiprocessor, Generic RTMpCpuId.
     3 * innotek Portable Runtime - Multiprocessor, Generic RTMpIsCpuOnline.
    44 */
    55
     
    3030*******************************************************************************/
    3131#include <iprt/mp.h>
    32 #include <iprt/asm.h>
    3332
    3433
    35 RTDECL(RTCPUID) RTMpCpuId(void)
     34RTDECL(bool) RTMpIsCpuOnline(RTCPUID idCpu)
    3635{
    37 #if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    38     return ASMGetApicId();
    39 #else
    40 # error "Not ported to this architecture."
    41     return NIL_RTAPICID;
    42 #endif
     36    return RTMpCpuId() == idCpu;
    4337}
    4438
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