github.com/sandwichdev/go-internals@v0.0.0-20210605002614-12311ac6b2c5/cpu/cpu_ppc64x_linux.go (about)

     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  // +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_3_00 = 0x00800000
    19  
    20  	// CPU features
    21  	hwcap2_DARN = 0x00200000
    22  	hwcap2_SCV  = 0x00100000
    23  )
    24  
    25  func osinit() {
    26  	PPC64.IsPOWER9 = isSet(HWCap2, hwcap2_ARCH_3_00)
    27  	PPC64.HasDARN = isSet(HWCap2, hwcap2_DARN)
    28  	PPC64.HasSCV = isSet(HWCap2, hwcap2_SCV)
    29  }