cpuid_linux_arm64.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // +build arm64,linux
  2. // Minio Cloud Storage, (C) 2016 Minio, Inc.
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. //
  16. package sha256
  17. import (
  18. "bytes"
  19. "io/ioutil"
  20. )
  21. func cpuid(op uint32) (eax, ebx, ecx, edx uint32) {
  22. return 0, 0, 0, 0
  23. }
  24. func cpuidex(op, op2 uint32) (eax, ebx, ecx, edx uint32) {
  25. return 0, 0, 0, 0
  26. }
  27. func xgetbv(index uint32) (eax, edx uint32) {
  28. return 0, 0
  29. }
  30. // File to check for cpu capabilities.
  31. const procCPUInfo = "/proc/cpuinfo"
  32. // Feature to check for.
  33. const sha256Feature = "sha2"
  34. func haveArmSha() bool {
  35. cpuInfo, err := ioutil.ReadFile(procCPUInfo)
  36. if err != nil {
  37. return false
  38. }
  39. return bytes.Contains(cpuInfo, []byte(sha256Feature))
  40. }