You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cpu_linux_ppc64x.go 775B

123456789101112131415161718192021222324252627282930
  1. // Copyright 2018 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. //go:build linux && (ppc64 || ppc64le)
  5. package cpu
  6. // HWCAP/HWCAP2 bits. These are exposed by the kernel.
  7. const (
  8. // ISA Level
  9. _PPC_FEATURE2_ARCH_2_07 = 0x80000000
  10. _PPC_FEATURE2_ARCH_3_00 = 0x00800000
  11. // CPU features
  12. _PPC_FEATURE2_DARN = 0x00200000
  13. _PPC_FEATURE2_SCV = 0x00100000
  14. )
  15. func doinit() {
  16. // HWCAP2 feature bits
  17. PPC64.IsPOWER8 = isSet(hwCap2, _PPC_FEATURE2_ARCH_2_07)
  18. PPC64.IsPOWER9 = isSet(hwCap2, _PPC_FEATURE2_ARCH_3_00)
  19. PPC64.HasDARN = isSet(hwCap2, _PPC_FEATURE2_DARN)
  20. PPC64.HasSCV = isSet(hwCap2, _PPC_FEATURE2_SCV)
  21. }
  22. func isSet(hwc uint, value uint) bool {
  23. return hwc&value != 0
  24. }