-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #159 from abiosoft/enable-nested-virtualization
add support for nested virtualization
- Loading branch information
Showing
5 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// virtualization_15.h | ||
|
||
#pragma once | ||
|
||
// FIXME(codehex): this is dirty hack to avoid clang-format error like below | ||
// "Configuration file(s) do(es) not support C++: /github.com/Code-Hex/vz/.clang-format" | ||
#define NSURLComponents NSURLComponents | ||
|
||
#import "virtualization_helper.h" | ||
#import <Virtualization/Virtualization.h> | ||
|
||
/* macOS 15 API */ | ||
bool isNestedVirtualizationSupported(); | ||
void setNestedVirtualizationEnabled(void *config, bool nestedVirtualizationEnabled); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// | ||
// virtualization_15.m | ||
// | ||
#import "virtualization_15.h" | ||
|
||
/*! | ||
@abstract Check if nested virtualization is supported. | ||
@return true if supported. | ||
*/ | ||
bool isNestedVirtualizationSupported() | ||
{ | ||
#ifdef INCLUDE_TARGET_OSX_15 | ||
if (@available(macOS 15, *)) { | ||
return (bool) VZGenericPlatformConfiguration.isNestedVirtualizationSupported; | ||
} | ||
#endif | ||
RAISE_UNSUPPORTED_MACOS_EXCEPTION(); | ||
} | ||
|
||
/*! | ||
@abstract Set nestedVirtualizationEnabled. The default is false. | ||
*/ | ||
void setNestedVirtualizationEnabled(void *config, bool nestedVirtualizationEnabled) | ||
{ | ||
#ifdef INCLUDE_TARGET_OSX_15 | ||
if (@available(macOS 15, *)) { | ||
VZGenericPlatformConfiguration *platformConfig = (VZGenericPlatformConfiguration *)config; | ||
platformConfig.nestedVirtualizationEnabled = (BOOL) nestedVirtualizationEnabled; | ||
return; | ||
} | ||
#endif | ||
RAISE_UNSUPPORTED_MACOS_EXCEPTION(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters