Source file src/vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go

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

View as plain text