diff options
Diffstat (limited to 'libgo/go')
-rw-r--r-- | libgo/go/runtime/alg.go | 1 | ||||
-rw-r--r-- | libgo/go/runtime/runtime2.go | 3 | ||||
-rw-r--r-- | libgo/go/runtime/stubs.go | 6 |
3 files changed, 9 insertions, 1 deletions
diff --git a/libgo/go/runtime/alg.go b/libgo/go/runtime/alg.go index 5ec19d0a9f9..53312313017 100644 --- a/libgo/go/runtime/alg.go +++ b/libgo/go/runtime/alg.go @@ -233,6 +233,7 @@ func alginit() { // Install aes hash algorithm if we have the instructions we need if (GOARCH == "386" || GOARCH == "amd64") && GOOS != "nacl" && + support_aes && cpuid_ecx&(1<<25) != 0 && // aes (aesenc) cpuid_ecx&(1<<9) != 0 && // sse3 (pshufb) cpuid_ecx&(1<<19) != 0 { // sse4.1 (pinsr{d,q}) diff --git a/libgo/go/runtime/runtime2.go b/libgo/go/runtime/runtime2.go index 978a3172d0f..6686e1f29b3 100644 --- a/libgo/go/runtime/runtime2.go +++ b/libgo/go/runtime/runtime2.go @@ -771,7 +771,8 @@ var ( // Information about what cpu features are available. // Set on startup. - cpuid_ecx uint32 + cpuid_ecx uint32 + support_aes bool // cpuid_edx uint32 // cpuid_ebx7 uint32 diff --git a/libgo/go/runtime/stubs.go b/libgo/go/runtime/stubs.go index dde9ebdfdd6..c299ae0e8eb 100644 --- a/libgo/go/runtime/stubs.go +++ b/libgo/go/runtime/stubs.go @@ -272,6 +272,12 @@ func setCpuidECX(v uint32) { cpuid_ecx = v } +// For gccgo, to communicate from the C code to the Go code. +//go:linkname setSupportAES runtime.setSupportAES +func setSupportAES(v bool) { + support_aes = v +} + // typedmemmove copies a typed value. // For gccgo for now. //go:nosplit |