VirtualBox

Changeset 11810 in vbox for trunk/src/VBox/Runtime/r3


Ignore:
Timestamp:
Aug 29, 2008 11:52:39 AM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
35640
Message:

RTMpIsCpuOnline() for Darwin

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/darwin/mp-darwin.cpp

    r11708 r11810  
    4242#include <sys/fcntl.h>
    4343#include <errno.h>
     44#include <mach/mach.h>
    4445
    4546#include <iprt/mp.h>
     
    9192RTDECL(bool) RTMpIsCpuOnline(RTCPUID idCpu)
    9293{
    93 #if 1
     94#if 0
    9495    return RTMpIsCpuPossible(idCpu);
    9596#else
    9697    /** @todo proper ring-3 support on darwin, see #3014. */
     98    natural_t nCpus;
     99    processor_basic_info_t pinfo;
     100    mach_msg_type_number_t count;
     101    kern_return_t krc = host_processor_info(mach_host_self(),
     102        PROCESSOR_BASIC_INFO, &nCpus, (processor_info_array_t*)&pinfo, &count);
     103    AssertReturn (krc == KERN_SUCCESS, true);
     104    bool isOnline = idCpu < nCpus ? pinfo[idCpu].running : true;
     105    vm_deallocate(mach_task_self(), (vm_address_t)pinfo, count * sizeof(*pinfo));
     106    return isOnline;
    97107#endif
    98108}
     
    131141RTDECL(PRTCPUSET) RTMpGetOnlineSet(PRTCPUSET pSet)
    132142{
    133 #if 1
     143#if 0
    134144    return RTMpGetSet(pSet);
    135145#else
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette