Changeset 9429 in vbox for trunk/src/VBox/Runtime/r0drv
- Timestamp:
- Jun 5, 2008 3:22:37 PM (17 years ago)
- Location:
- trunk/src/VBox/Runtime/r0drv
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c
r8245 r9429 66 66 67 67 68 RTDECL(bool) RTMpIsCpu Online(RTCPUID idCpu)69 { 70 #if def CONFIG_SMP68 RTDECL(bool) RTMpIsCpuPossible(RTCPUID idCpu) 69 { 70 #if defined(CONFIG_SMP) 71 71 if (RT_UNLIKELY(idCpu >= NR_CPUS)) 72 72 return false; 73 # ifdef cpu_online 74 return cpu_online(idCpu); 75 # else /* 2.4: */ 76 return cpu_online_map & RT_BIT_64(idCpu); 77 # endif 78 #else 79 return idCpu == RTMpCpuId(); 80 #endif 81 } 82 83 84 RTDECL(bool) RTMpDoesCpuExist(RTCPUID idCpu) 85 { 86 #ifdef CONFIG_SMP 87 if (RT_UNLIKELY(idCpu >= NR_CPUS)) 88 return false; 89 # ifdef CONFIG_HOTPLUG_CPU /* introduced & uses cpu_present */ 90 return cpu_present(idCpu); 91 # elif defined(cpu_possible) 73 74 # if defined(cpu_possible) 92 75 return cpu_possible(idCpu); 93 # else /* 2.4:*/76 # else /* < 2.5.29 */ 94 77 return idCpu < (RTCPUID)smp_num_cpus; 95 78 # endif … … 108 91 do 109 92 { 110 if (RTMp DoesCpuExist(idCpu))93 if (RTMpIsCpuPossible(idCpu)) 111 94 RTCpuSetAdd(pSet, idCpu); 112 95 } while (idCpu-- > 0); … … 135 118 136 119 120 RTDECL(bool) RTMpIsCpuOnline(RTCPUID idCpu) 121 { 122 #ifdef CONFIG_SMP 123 if (RT_UNLIKELY(idCpu >= NR_CPUS)) 124 return false; 125 # ifdef cpu_online 126 return cpu_online(idCpu); 127 # else /* 2.4: */ 128 return cpu_online_map & RT_BIT_64(idCpu); 129 # endif 130 #else 131 return idCpu == RTMpCpuId(); 132 #endif 133 } 134 135 137 136 RTDECL(PRTCPUSET) RTMpGetOnlineSet(PRTCPUSET pSet) 138 137 { … … 272 271 Args.cHits = 0; 273 272 274 if (!RTMp DoesCpuExist(idCpu))273 if (!RTMpIsCpuPossible(idCpu)) 275 274 return VERR_CPU_NOT_FOUND; 276 275 -
trunk/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp
r8840 r9429 95 95 return false; 96 96 97 /** @todo this must be done at init time as it's not safe under all circumstances (braindead OS design). */ 97 98 KAFFINITY Mask = KeQueryActiveProcessors(); 98 99 return !!(Mask & RT_BIT_64(idCpu)); … … 100 101 101 102 102 RTDECL(bool) RTMp DoesCpuExist(RTCPUID idCpu)103 RTDECL(bool) RTMpIsCpuPresent(RTCPUID idCpu) 103 104 { 104 105 /* Cannot easily distinguish between online and offline cpus. */ 106 /** @todo online/present cpu stuff must be corrected for proper W2K8 support. */ 105 107 return RTMpIsCpuOnline(idCpu); 106 108 } … … 109 111 RTDECL(PRTCPUSET) RTMpGetSet(PRTCPUSET pSet) 110 112 { 113 /** @todo online/present cpu stuff must be corrected for proper W2K8 support. */ 111 114 return RTMpGetOnlineSet(pSet); 112 115 } … … 115 118 RTDECL(RTCPUID) RTMpGetCount(void) 116 119 { 120 /** @todo online/present cpu stuff must be corrected for proper W2K8 support. */ 117 121 return RTMpGetOnlineCount(); 118 122 } … … 167 171 #if 0 168 172 /* KeFlushQueuedDpcs must be run at IRQL PASSIVE_LEVEL according to MSDN, but the 169 * driver verifier doesn't complain... 173 * driver verifier doesn't complain... 170 174 */ 171 175 AssertMsg(KeGetCurrentIrql() == PASSIVE_LEVEL, ("%d != %d (PASSIVE_LEVEL)\n", KeGetCurrentIrql(), PASSIVE_LEVEL)); … … 173 177 174 178 KAFFINITY Mask = KeQueryActiveProcessors(); 175 176 if ( enmCpuid == RT_NT_CPUID_SPECIFIC177 && ( idCpu >= 64178 || !(Mask & RT_BIT_64(idCpu))))179 return VERR_CPU_NOT_FOUND; /* can't distinguish between cpu not present or offline */180 179 181 180 /* KeFlushQueuedDpcs is not present in Windows 2000; import it dynamically so we can just fail this call. */ … … 244 243 } 245 244 if (enmCpuid != RT_NT_CPUID_OTHERS) 246 {247 245 pfnWorker(iSelf, pvUser1, pvUser2); 248 }249 246 } 250 247 … … 270 267 RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2) 271 268 { 269 if (RTMpIsCpuOnline(idCpu); 270 return !RTMpIsCpuPossible(idCpu) ? VERR_CPU_NOT_FOUND : VERR_CPU_OFFLINE; 271 272 272 return rtMpCall(pfnWorker, pvUser1, pvUser2, RT_NT_CPUID_SPECIFIC, idCpu); 273 273 } -
trunk/src/VBox/Runtime/r0drv/solaris/mp-r0drv-solaris.c
r8245 r9429 66 66 67 67 68 RTDECL(bool) RTMpIsCpuOnline(RTCPUID idCpu) 69 { 70 cpu_t *pCpu = idCpu < NCPU ? cpu_get(idCpu) : NULL; 71 return pCpu 72 && cpu_is_online(pCpu); 73 } 74 75 76 RTDECL(bool) RTMpDoesCpuExist(RTCPUID idCpu) 68 RTDECL(bool) RTMpIsCpuPossible(RTCPUID idCpu) 77 69 { 78 70 cpu_t *pCpu = idCpu < NCPU ? cpu_get(idCpu) : NULL; … … 89 81 do 90 82 { 91 if (RTMp DoesCpuExist(idCpu))83 if (RTMpIsCpuPossible(idCpu)) 92 84 RTCpuSetAdd(pSet, idCpu); 93 85 } while (idCpu-- > 0); … … 100 92 { 101 93 return ncpus; 94 } 95 96 97 RTDECL(bool) RTMpIsCpuOnline(RTCPUID idCpu) 98 { 99 cpu_t *pCpu = idCpu < NCPU ? cpu_get(idCpu) : NULL; 100 return pCpu 101 && cpu_is_online(pCpu); 102 102 } 103 103 -
trunk/src/VBox/Runtime/r0drv/solaris/vbi/mp-r0drv-solaris.c
r9149 r9429 72 72 73 73 74 RTDECL(bool) RTMp DoesCpuExist(RTCPUID idCpu)74 RTDECL(bool) RTMpIsCpuPossible(RTCPUID idCpu) 75 75 { 76 76 return idCpu < vbi_cpu_count(); … … 86 86 do 87 87 { 88 if (RTMp DoesCpuExist(idCpu))88 if (RTMpIsCpuPossible(idCpu)) 89 89 RTCpuSetAdd(pSet, idCpu); 90 90 } while (idCpu-- > 0);
Note:
See TracChangeset
for help on using the changeset viewer.