cpu_ppc64x_linux.mx raw

   1  // Copyright 2020 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  
   5  //go:build ppc64 || ppc64le
   6  
   7  package cpu
   8  
   9  // ppc64 doesn't have a 'cpuid' equivalent, so we rely on HWCAP/HWCAP2.
  10  // These are initialized by archauxv and should not be changed after they are
  11  // initialized.
  12  var HWCap uint
  13  var HWCap2 uint
  14  
  15  // HWCAP bits. These are exposed by Linux.
  16  const (
  17  	// ISA Level
  18  	hwcap2_ARCH_2_07 = 0x80000000
  19  	hwcap2_ARCH_3_00 = 0x00800000
  20  	hwcap2_ARCH_3_1  = 0x00040000
  21  
  22  	// CPU features
  23  	hwcap2_DARN = 0x00200000
  24  	hwcap2_SCV  = 0x00100000
  25  )
  26  
  27  func osinit() {
  28  	PPC64.IsPOWER8 = isSet(HWCap2, hwcap2_ARCH_2_07)
  29  	PPC64.IsPOWER9 = isSet(HWCap2, hwcap2_ARCH_3_00)
  30  	PPC64.IsPOWER10 = isSet(HWCap2, hwcap2_ARCH_3_1)
  31  	PPC64.HasDARN = isSet(HWCap2, hwcap2_DARN)
  32  	PPC64.HasSCV = isSet(HWCap2, hwcap2_SCV)
  33  }
  34