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 776B

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