Changeset 16354 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Jan 28, 2009 11:52:28 PM (16 years ago)
- Location:
- trunk/src/VBox/Runtime/r0drv/darwin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/darwin/mp-r0drv-darwin.cpp
r16328 r16354 44 44 45 45 46 /******************************************************************************* 47 * Global Variables * 48 *******************************************************************************/ 49 static int32_t volatile g_cMaxCpus = -1; 50 51 52 static int rtMpDarwinInitMaxCpus(void) 53 { 54 int32_t cCpus = -1; 55 #ifdef RT_ARCH_AMD64 56 size_t oldLen = sizeof(cCpus); 57 int rc = sysctlbyname("hw.ncpu", &cCpus, &oldLen, NULL, NULL); 58 if (rc) 59 { 60 printf("IPRT: sysctlbyname(hw.ncpu) failed with rc=%d!\n", rc); 61 cCpus = MY_DARWIN_MAX_CPUS; 62 } 63 #else 64 cCpus = ml_get_max_cpus(); 65 #endif 66 67 ASMAtomicWriteS32(&g_cMaxCpus, cCpus); 68 return cCpus; 69 } 70 71 46 72 DECLINLINE(int) rtMpDarwinMaxCpus(void) 47 73 { 48 return ml_get_max_cpus(); 74 int cCpus = g_cMaxCpus; 75 if (RT_UNLIKELY(cCpus <= 0)) 76 return rtMpDarwinInitMaxCpus(); 77 return cCpus; 49 78 } 50 79 -
trunk/src/VBox/Runtime/r0drv/darwin/the-darwin-kernel.h
r16330 r16354 63 63 #endif 64 64 #include <libkern/libkern.h> 65 #include <libkern/sysctl.h> 65 66 #include <mach/thread_act.h> 66 67 #include <mach/vm_map.h>
Note:
See TracChangeset
for help on using the changeset viewer.