This repository was archived by the owner on Oct 19, 2024. It is now read-only.
File tree 5 files changed +76
-0
lines changed
5 files changed +76
-0
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,8 @@ func macOSBuildTargetAvailable(version float64) error {
105
105
target = 130000 // __MAC_13_0
106
106
case 14 :
107
107
target = 140000 // __MAC_14_0
108
+ case 15 :
109
+ target = 150000 // __MAC_15_0
108
110
}
109
111
if allowedVersion < target {
110
112
return fmt .Errorf ("%w for %.1f (the binary was built with __MAC_OS_X_VERSION_MAX_ALLOWED=%d; needs recompilation)" ,
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ package vz
6
6
# include "virtualization_11.h"
7
7
# include "virtualization_12.h"
8
8
# include "virtualization_13.h"
9
+ # include "virtualization_15.h"
9
10
*/
10
11
import "C"
11
12
import (
@@ -40,6 +41,28 @@ func (m *GenericPlatformConfiguration) MachineIdentifier() *GenericMachineIdenti
40
41
return m .machineIdentifier
41
42
}
42
43
44
+ // IsNestedVirtualizationSupported reports if nested virtualization is supported.
45
+ func IsNestedVirtualizationSupported () bool {
46
+ if err := macOSAvailable (15 ); err != nil {
47
+ return false
48
+ }
49
+
50
+ return (bool )(C .isNestedVirtualizationSupported ())
51
+ }
52
+
53
+ // SetNestedVirtualizationEnabled toggles nested virtualization.
54
+ func (m * GenericPlatformConfiguration ) SetNestedVirtualizationEnabled (enable bool ) error {
55
+ if err := macOSAvailable (15 ); err != nil {
56
+ return err
57
+ }
58
+
59
+ C .setNestedVirtualizationEnabled (
60
+ objc .Ptr (m ),
61
+ C .bool (enable ),
62
+ )
63
+ return nil
64
+ }
65
+
43
66
var _ PlatformConfiguration = (* GenericPlatformConfiguration )(nil )
44
67
45
68
// NewGenericPlatformConfiguration creates a new generic platform configuration.
Original file line number Diff line number Diff line change
1
+ //
2
+ // virtualization_15.h
3
+
4
+ #pragma once
5
+
6
+ #import " virtualization_helper.h"
7
+ #import < Virtualization/Virtualization.h>
8
+
9
+ /* macOS 15 API */
10
+ bool isNestedVirtualizationSupported ();
11
+ void setNestedVirtualizationEnabled (void *config, bool nestedVirtualizationEnabled);
Original file line number Diff line number Diff line change
1
+ //
2
+ // virtualization_15.m
3
+ //
4
+ #import " virtualization_15.h"
5
+
6
+ /* !
7
+ @abstract Check if nested virtualization is supported.
8
+ @return true if supported.
9
+ */
10
+ bool isNestedVirtualizationSupported ()
11
+ {
12
+ #ifdef INCLUDE_TARGET_OSX_15
13
+ if (@available (macOS 15 , *)) {
14
+ return (bool ) VZGenericPlatformConfiguration.isNestedVirtualizationSupported ;
15
+ }
16
+ #endif
17
+ RAISE_UNSUPPORTED_MACOS_EXCEPTION ();
18
+ }
19
+
20
+ /* !
21
+ @abstract Set nestedVirtualizationEnabled. The default is false.
22
+ */
23
+ void setNestedVirtualizationEnabled (void *config, bool nestedVirtualizationEnabled)
24
+ {
25
+ #ifdef INCLUDE_TARGET_OSX_15
26
+ if (@available (macOS 15 , *)) {
27
+ VZGenericPlatformConfiguration *platformConfig = (VZGenericPlatformConfiguration *)config;
28
+ platformConfig.nestedVirtualizationEnabled = (BOOL ) nestedVirtualizationEnabled;
29
+ return ;
30
+ }
31
+ #endif
32
+ RAISE_UNSUPPORTED_MACOS_EXCEPTION ();
33
+ }
Original file line number Diff line number Diff line change @@ -39,6 +39,13 @@ NSDictionary *dumpProcessinfo();
39
39
#pragma message("macOS 14 API has been disabled")
40
40
#endif
41
41
42
+ // for macOS 15 API
43
+ #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 150000
44
+ #define INCLUDE_TARGET_OSX_15 1
45
+ #else
46
+ #pragma message("macOS 15 API has been disabled")
47
+ #endif
48
+
42
49
static inline int mac_os_x_version_max_allowed ()
43
50
{
44
51
#ifdef __MAC_OS_X_VERSION_MAX_ALLOWED
You can’t perform that action at this time.
0 commit comments