github.com/primecitizens/pcz/std@v0.2.1/core/cpu/cpu_arm.go (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  //
     4  // Copyright 2017 The Go Authors. All rights reserved.
     5  // Use of this source code is governed by a BSD-style
     6  // license that can be found in the LICENSE file.
     7  
     8  //go:build arm
     9  
    10  package cpu
    11  
    12  const CacheLinePadSize = 32
    13  
    14  // arm doesn't have a 'cpuid' equivalent, so we rely on HWCAP/HWCAP2.
    15  // These are initialized by archauxv() and should not be changed after they are
    16  // initialized.
    17  var (
    18  	HWCap  uint
    19  	HWCap2 uint
    20  )
    21  
    22  // HWCAP/HWCAP2 bits. These are exposed by Linux and FreeBSD.
    23  const (
    24  	hwcap_VFPv4 = 1 << 16
    25  	hwcap_IDIVA = 1 << 17
    26  )
    27  
    28  func doinit() {
    29  	// HWCAP feature bits
    30  	ARM.HasVFPv4 = isSet(HWCap, hwcap_VFPv4)
    31  	ARM.HasIDIVA = isSet(HWCap, hwcap_IDIVA)
    32  }
    33  
    34  func isSet(hwc uint, value uint) bool {
    35  	return hwc&value != 0
    36  }