cpu_ppc64x.go 787 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. // +build ppc64 ppc64le
  5. package cpu
  6. const cacheLineSize = 128
  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. }