mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-03 07:37:34 -04:00
windows: add IsProcessorFeaturePresent and processor feature consts
For golang/go#76791 Change-Id: I1594c4868262c78d40e1ebd883a01a71236e4981 Reviewed-on: https://go-review.googlesource.com/c/sys/+/740500 Reviewed-by: Quim Muntal <quimmuntal@gmail.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
@@ -1493,3 +1493,22 @@ func TestRoundtripNTUnicodeString(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsProcessorFeaturePresent(t *testing.T) {
|
||||
// according to
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-isprocessorfeaturepresent
|
||||
// if PF_PAE_ENABLED returns nonzero value, then
|
||||
// ...
|
||||
// The processor is PAE-enabled. For more information, see Physical Address Extension.
|
||||
// All x64 processors always return a nonzero value for this feature.
|
||||
// ...
|
||||
switch runtime.GOARCH {
|
||||
case "amd64", "386":
|
||||
default:
|
||||
t.Skipf("the test is no supported by %q processor type", runtime.GOARCH)
|
||||
}
|
||||
|
||||
if !windows.IsProcessorFeaturePresent(windows.PF_PAE_ENABLED) {
|
||||
t.Fatal("IsProcessorFeaturePresent failed, but should succeed")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user