VirtualBox

Ignore:
Timestamp:
Jun 7, 2023 5:45:33 PM (21 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
157790
Message:

HostDrivers/Support/darwin: Implement suplibOsIsNemSupportedWhenNoVtxOrAmdV() and query kern.hv.supported in order to determine whether NEM is available. Allows to mark hardware virtualization as supported so the GUI allows setting the CPU count for a VM , bugref:10454

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/darwin/SUPLib-darwin.cpp

    r98103 r100097  
    6363#include <sys/fcntl.h>
    6464#include <sys/ioctl.h>
     65#include <sys/types.h>
     66#include <sys/sysctl.h>
    6567#include <errno.h>
    6668#include <unistd.h>
     
    330332}
    331333
     334
     335DECLHIDDEN(bool) suplibOsIsNemSupportedWhenNoVtxOrAmdV(void)
     336{
     337# if ARCH_BITS == 64
     338    int fHvSupported = 0;
     339    size_t cb = sizeof(fHvSupported);
     340    int rc = sysctlbyname("kern.hv.supported", &fHvSupported, &cb, NULL, 0);
     341    if (   !rc
     342        && cb == sizeof(uint32_t))
     343        return fHvSupported == 1;
     344
     345    return false;
     346# else
     347    return false;
     348#endif
     349}
     350
    332351#endif /* !IN_SUP_HARDENED_R3 */
    333352
Note: See TracChangeset for help on using the changeset viewer.

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