Changeset 7348 in vbox for trunk/src/VBox/Runtime/generic
- Timestamp:
- Mar 7, 2008 10:37:10 AM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 28767
- Location:
- trunk/src/VBox/Runtime/generic
- Files:
-
- 9 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/generic/RTMpCpuIdFromSetIndex-generic.cpp
r7337 r7348 1 1 /* $Id$ */ 2 2 /** @file 3 * innotek Portable Runtime - Multiprocessor, Generic RTMpCpuId .3 * innotek Portable Runtime - Multiprocessor, Generic RTMpCpuIdFromSetIndex. 4 4 */ 5 5 … … 30 30 *******************************************************************************/ 31 31 #include <iprt/mp.h> 32 #include <iprt/asm.h>33 32 34 33 35 RTDECL(RTCPUID) RTMpCpuId (void)34 RTDECL(RTCPUID) RTMpCpuIdFromSetIndex(int iCpu) 36 35 { 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; 43 37 } 44 38 -
trunk/src/VBox/Runtime/generic/RTMpCpuIdToSetIndex-generic.cpp
r7337 r7348 1 1 /* $Id$ */ 2 2 /** @file 3 * innotek Portable Runtime - Multiprocessor, Generic RTMpCpuId .3 * innotek Portable Runtime - Multiprocessor, Generic RTMpCpuIdToSetIndex. 4 4 */ 5 5 … … 30 30 *******************************************************************************/ 31 31 #include <iprt/mp.h> 32 #include <iprt/asm.h>33 32 34 33 35 RTDECL( RTCPUID) RTMpCpuId(void)34 RTDECL(int) RTMpCpuIdToSetIndex(RTCPUID idCpu) 36 35 { 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; 43 37 } 44 38 -
trunk/src/VBox/Runtime/generic/RTMpDoesCpuExist-generic.cpp
r7336 r7348 1 1 /* $Id$ */ 2 2 /** @file 3 * innotek Portable Runtime - Multiprocessor, Generic RTMp CpuId.3 * innotek Portable Runtime - Multiprocessor, Generic RTMpDoesCpuExist. 4 4 */ 5 5 … … 30 30 *******************************************************************************/ 31 31 #include <iprt/mp.h> 32 #include <iprt/asm.h>33 32 34 33 35 RTDECL( RTCPUID) RTMpCpuId(void)34 RTDECL(bool) RTMpDoesCpuExist(RTCPUID idCpu) 36 35 { 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; 43 37 } 44 38 -
trunk/src/VBox/Runtime/generic/RTMpGetCount-generic.cpp
r7337 r7348 1 1 /* $Id$ */ 2 2 /** @file 3 * innotek Portable Runtime - Multiprocessor, Generic RTMp CpuId.3 * innotek Portable Runtime - Multiprocessor, Generic RTMpGetCount. 4 4 */ 5 5 … … 30 30 *******************************************************************************/ 31 31 #include <iprt/mp.h> 32 #include <iprt/ asm.h>32 #include <iprt/cpuset.h> 33 33 34 34 35 RTDECL(RTCPUID) RTMp CpuId(void)35 RTDECL(RTCPUID) RTMpGetCount(void) 36 36 { 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); 43 40 } 44 41 -
trunk/src/VBox/Runtime/generic/RTMpGetMaxCpuId-generic.cpp
r7337 r7348 1 1 /* $Id$ */ 2 2 /** @file 3 * innotek Portable Runtime - Multiprocessor, Generic RTMp CpuId.3 * innotek Portable Runtime - Multiprocessor, Generic RTMpGetMaxCpuId. 4 4 */ 5 5 … … 30 30 *******************************************************************************/ 31 31 #include <iprt/mp.h> 32 #include <iprt/asm.h>33 32 34 33 35 RTDECL(RTCPUID) RTMp CpuId(void)34 RTDECL(RTCPUID) RTMpGetMaxCpuId(void) 36 35 { 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(); 43 37 } 44 38 -
trunk/src/VBox/Runtime/generic/RTMpGetOnlineCount-generic.cpp
r7337 r7348 1 1 /* $Id$ */ 2 2 /** @file 3 * innotek Portable Runtime - Multiprocessor, Generic RTMp CpuId.3 * innotek Portable Runtime - Multiprocessor, Generic RTMpGetOnlineCount. 4 4 */ 5 5 … … 30 30 *******************************************************************************/ 31 31 #include <iprt/mp.h> 32 #include <iprt/ asm.h>32 #include <iprt/cpuset.h> 33 33 34 34 35 RTDECL(RTCPUID) RTMp CpuId(void)35 RTDECL(RTCPUID) RTMpGetOnlineCount(void) 36 36 { 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); 43 40 } 44 41 -
trunk/src/VBox/Runtime/generic/RTMpGetOnlineSet-generic.cpp
r7337 r7348 1 1 /* $Id$ */ 2 2 /** @file 3 * innotek Portable Runtime - Multiprocessor, Generic RTMp CpuId.3 * innotek Portable Runtime - Multiprocessor, Generic RTMpGetOnlineSet. 4 4 */ 5 5 … … 30 30 *******************************************************************************/ 31 31 #include <iprt/mp.h> 32 #include <iprt/ asm.h>32 #include <iprt/cpuset.h> 33 33 34 34 35 RTDECL( RTCPUID) RTMpCpuId(void)35 RTDECL(PRTCPUSET) RTMpGetOnlineSet(PRTCPUSET pSet) 36 36 { 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; 43 47 } 44 48 -
trunk/src/VBox/Runtime/generic/RTMpGetSet-generic.cpp
r7337 r7348 1 1 /* $Id$ */ 2 2 /** @file 3 * innotek Portable Runtime - Multiprocessor, Generic RTMp CpuId.3 * innotek Portable Runtime - Multiprocessor, Generic RTMpGetSet. 4 4 */ 5 5 … … 30 30 *******************************************************************************/ 31 31 #include <iprt/mp.h> 32 #include <iprt/ asm.h>32 #include <iprt/cpuset.h> 33 33 34 34 35 RTDECL( RTCPUID) RTMpCpuId(void)35 RTDECL(PRTCPUSET) RTMpGetSet(PRTCPUSET pSet) 36 36 { 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; 43 47 } 44 48 -
trunk/src/VBox/Runtime/generic/RTMpIsCpuOnline-generic.cpp
r7336 r7348 1 1 /* $Id$ */ 2 2 /** @file 3 * innotek Portable Runtime - Multiprocessor, Generic RTMp CpuId.3 * innotek Portable Runtime - Multiprocessor, Generic RTMpIsCpuOnline. 4 4 */ 5 5 … … 30 30 *******************************************************************************/ 31 31 #include <iprt/mp.h> 32 #include <iprt/asm.h>33 32 34 33 35 RTDECL( RTCPUID) RTMpCpuId(void)34 RTDECL(bool) RTMpIsCpuOnline(RTCPUID idCpu) 36 35 { 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; 43 37 } 44 38
Note:
See TracChangeset
for help on using the changeset viewer.