Changeset 94087 in vbox for trunk/src/VBox/Runtime/r3/darwin
- Timestamp:
- Mar 4, 2022 2:03:32 PM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 150332
- Location:
- trunk/src/VBox/Runtime/r3/darwin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/darwin/RTMpGetDescription-generic.cpp
r93115 r94087 50 50 * Just use the sysctl machdep.cpu.brand_string value for now. 51 51 */ 52 /** @todo on arm this is very boring, so we could use the cpufamily and 53 * cpusubfamily instead... */ 52 /** @todo on arm this is very boring and there are two different types of 53 * cores in the system, "E" and "P" cores. The I/O registry can 54 * be used to find out which @a idCpu is. There are also codename 55 * available there. */ 54 56 char szBrand[128] = {0}; 55 57 size_t cb = sizeof(szBrand); -
trunk/src/VBox/Runtime/r3/darwin/mp-darwin.cpp
r93115 r94087 54 54 55 55 #include <iprt/mp.h> 56 #include <iprt/assert.h> 56 57 #include <iprt/cpuset.h> 57 #include <iprt/assert.h>58 58 #include <iprt/log.h> 59 59 #include <iprt/string.h> … … 174 174 #else 175 175 /** @todo proper ring-3 support on darwin, see @bugref{3014}. */ 176 natural_t nCpus;177 processor_basic_info_t p info;178 mach_msg_type_number_t c ount;179 kern_return_t krc = host_processor_info(mach_host_self(), 180 PROCESSOR_BASIC_INFO, &nCpus, (processor_info_array_t*)&pinfo, &count);181 AssertReturn 182 bool isOnline = idCpu < nCpus ? pinfo[idCpu].running : false;183 vm_deallocate(mach_task_self(), (vm_address_t)p info, count * sizeof(*pinfo));184 return isOnline;176 natural_t cCpus; 177 processor_basic_info_t paInfo; 178 mach_msg_type_number_t cInfo; 179 kern_return_t krc = host_processor_info(mach_host_self(), PROCESSOR_BASIC_INFO, 180 &cCpus, (processor_info_array_t*)&paInfo, &cInfo); 181 AssertReturn(krc == KERN_SUCCESS, true); 182 bool const fIsOnline = idCpu < cCpus ? paInfo[idCpu].running : false; 183 vm_deallocate(mach_task_self(), (vm_address_t)paInfo, cInfo * sizeof(paInfo[0])); 184 return fIsOnline; 185 185 #endif 186 186 } … … 225 225 RTDECL(PRTCPUSET) RTMpGetOnlineSet(PRTCPUSET pSet) 226 226 { 227 RTCpuSetEmpty(pSet); 227 228 #if 0 228 return RTMpGetSet(pSet);229 #else230 RTCpuSetEmpty(pSet);231 229 RTCPUID cMax = rtMpDarwinMaxLogicalCpus(); 232 230 for (RTCPUID idCpu = 0; idCpu < cMax; idCpu++) 233 231 if (RTMpIsCpuOnline(idCpu)) 234 232 RTCpuSetAdd(pSet, idCpu); 233 #else 234 natural_t cCpus = 0; 235 processor_basic_info_t paInfo = NULL; 236 mach_msg_type_number_t cInfo = 0; 237 kern_return_t krc = host_processor_info(mach_host_self(), PROCESSOR_BASIC_INFO, 238 &cCpus, (processor_info_array_t *)&paInfo, &cInfo); 239 AssertReturn(krc == KERN_SUCCESS, pSet); 240 241 AssertStmt(cCpus <= RTCPUSET_MAX_CPUS, cCpus = RTCPUSET_MAX_CPUS); 242 for (natural_t idCpu = 0; idCpu < cCpus; idCpu++) 243 if (paInfo[idCpu].running) 244 RTCpuSetAdd(pSet, idCpu); 245 246 vm_deallocate(mach_task_self(), (vm_address_t)paInfo, cInfo * sizeof(paInfo[0])); 247 #endif 235 248 return pSet; 236 #endif237 249 } 238 250 … … 254 266 RTDECL(uint32_t) RTMpGetCurFrequency(RTCPUID idCpu) 255 267 { 256 /** @todo figure out how to get the current cpu speed on darwin. Have to check what powermanagement does. */ 268 /** @todo figure out how to get the current cpu speed on darwin. Have to 269 * check what powermanagement does. The powermetrics uses a private 270 * IOReportXxxx interface and *seems* (guessing) to calculate the frequency 271 * based on the frequency distribution over the last report period... This 272 * means that it's not really an suitable API for here. */ 257 273 NOREF(idCpu); 258 274 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.