cpu_linux_ppc64x.go 815 B

1234567891011121314151617181920212223242526272829303132
  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. // +build linux
  6. // +build ppc64 ppc64le
  7. package cpu
  8. // HWCAP/HWCAP2 bits. These are exposed by the kernel.
  9. const (
  10. // ISA Level
  11. _PPC_FEATURE2_ARCH_2_07 = 0x80000000
  12. _PPC_FEATURE2_ARCH_3_00 = 0x00800000
  13. // CPU features
  14. _PPC_FEATURE2_DARN = 0x00200000
  15. _PPC_FEATURE2_SCV = 0x00100000
  16. )
  17. func doinit() {
  18. // HWCAP2 feature bits
  19. PPC64.IsPOWER8 = isSet(hwCap2, _PPC_FEATURE2_ARCH_2_07)
  20. PPC64.IsPOWER9 = isSet(hwCap2, _PPC_FEATURE2_ARCH_3_00)
  21. PPC64.HasDARN = isSet(hwCap2, _PPC_FEATURE2_DARN)
  22. PPC64.HasSCV = isSet(hwCap2, _PPC_FEATURE2_SCV)
  23. }
  24. func isSet(hwc uint, value uint) bool {
  25. return hwc&value != 0
  26. }