-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(wsl): support detection of current system has virtualization ena…
…bled (#75) Signed-off-by: Kevin Cui <[email protected]>
- Loading branch information
1 parent
1ef7e64
commit c3eb16f
Showing
5 changed files
with
59 additions
and
9 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,19 @@ | ||
package sys | ||
|
||
import ( | ||
"github.com/oomol-lab/ovm-win/pkg/winapi" | ||
) | ||
|
||
// https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-isprocessorfeaturepresent | ||
const ( | ||
PF_SECOND_LEVEL_ADDRESS_TRANSLATION = 20 | ||
PF_VIRT_FIRMWARE_ENABLED = 21 | ||
) | ||
|
||
// IsSupportedVirtualization checks if the system supports virtualization | ||
func IsSupportedVirtualization() (vf, slat bool) { | ||
vf = winapi.IsProcessorFeaturePresent(PF_VIRT_FIRMWARE_ENABLED) | ||
slat = winapi.IsProcessorFeaturePresent(PF_SECOND_LEVEL_ADDRESS_TRANSLATION) | ||
|
||
return | ||
} |
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