gitee.com/ks-custle/core-gm@v0.0.0-20230922171213-b83bdd97b62c/internal/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  //go:build ppc64 || ppc64le
     6  // +build ppc64 ppc64le
     7  
     8  package cpu
     9  
    10  // ppc64 doesn't have a 'cpuid' equivalent, so we rely on HWCAP/HWCAP2.
    11  // These are initialized by archauxv and should not be changed after they are
    12  // initialized.
    13  var HWCap uint
    14  var HWCap2 uint
    15  
    16  // HWCAP bits. These are exposed by Linux.
    17  const (
    18  	// ISA Level
    19  	hwcap2_ARCH_3_00 = 0x00800000
    20  
    21  	// CPU features
    22  	hwcap2_DARN = 0x00200000
    23  	hwcap2_SCV  = 0x00100000
    24  )
    25  
    26  func osinit() {
    27  	PPC64.IsPOWER9 = isSet(HWCap2, hwcap2_ARCH_3_00)
    28  	PPC64.HasDARN = isSet(HWCap2, hwcap2_DARN)
    29  	PPC64.HasSCV = isSet(HWCap2, hwcap2_SCV)
    30  }