Changeset 19000 in vbox for trunk/src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c
- Timestamp:
- Apr 17, 2009 7:59:40 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c
r18969 r19000 38 38 #include <iprt/err.h> 39 39 #include <iprt/asm.h> 40 #include <iprt/cpuset.h> 40 41 #include "r0drv/mp-r0drv.h" 41 42 … … 46 47 } 47 48 49 50 RTDECL(int) RTMpCpuIdToSetIndex(RTCPUID idCpu) 51 { 52 return (int)idCpu < mp_ncpus ? (int)idCpu : -1; 53 } 54 55 56 RTDECL(RTCPUID) RTMpCpuIdFromSetIndex(int iCpu) 57 { 58 return iCpu < mp_ncpus ? (RTCPUID)iCpu : NIL_RTCPUID; 59 } 60 61 RTDECL(RTCPUID) RTMpGetMaxCpuId(void) 62 { 63 return mp_ncpus; 64 } 65 66 RTDECL(bool) RTMpIsCpuPossible(RTCPUID idCpu) 67 { 68 if (RT_UNLIKELY((int)idCpu > mp_ncpus)) 69 return false; 70 else 71 return true; 72 } 73 74 RTDECL(PRTCPUSET) RTMpGetSet(PRTCPUSET pSet) 75 { 76 RTCPUID idCpu; 77 78 RTCpuSetEmpty(pSet); 79 idCpu = RTMpGetMaxCpuId(); 80 do 81 { 82 if (RTMpIsCpuPossible(idCpu)) 83 RTCpuSetAdd(pSet, idCpu); 84 } while (idCpu-- > 0); 85 return pSet; 86 } 87 88 89 RTDECL(RTCPUID) RTMpGetCount(void) 90 { 91 return mp_ncpus; 92 } 93 94 95 RTDECL(bool) RTMpIsCpuOnline(RTCPUID idCpu) 96 { 97 if (RT_UNLIKELY((int)idCpu > mp_ncpus)) 98 return false; 99 100 return CPU_ABSENT(idCpu) ? false : true; 101 } 102 103 RTDECL(PRTCPUSET) RTMpGetOnlineSet(PRTCPUSET pSet) 104 { 105 RTCPUID idCpu; 106 107 RTCpuSetEmpty(pSet); 108 idCpu = RTMpGetMaxCpuId(); 109 do 110 { 111 if (RTMpIsCpuOnline(idCpu)) 112 RTCpuSetAdd(pSet, idCpu); 113 } while (idCpu-- > 0); 114 115 return pSet; 116 } 117 118 119 RTDECL(RTCPUID) RTMpGetOnlineCount(void) 120 { 121 return mp_ncpus; 122 } 48 123 49 124 /**
Note:
See TracChangeset
for help on using the changeset viewer.