Source file src/internal/cpu/cpu_arm.go

     1  // Copyright 2017 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  package cpu
     6  
     7  const CacheLinePadSize = 32
     8  
     9  // arm 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/HWCAP2 bits. These are exposed by Linux and FreeBSD.
    16  const (
    17  	hwcap_VFPv4 = 1 << 16
    18  	hwcap_IDIVA = 1 << 17
    19  )
    20  
    21  func doinit() {
    22  	options = []option{
    23  		{Name: "vfpv4", Feature: &ARM.HasVFPv4},
    24  		{Name: "idiva", Feature: &ARM.HasIDIVA},
    25  	}
    26  
    27  	// HWCAP feature bits
    28  	ARM.HasVFPv4 = isSet(HWCap, hwcap_VFPv4)
    29  	ARM.HasIDIVA = isSet(HWCap, hwcap_IDIVA)
    30  }
    31  
    32  func isSet(hwc uint, value uint) bool {
    33  	return hwc&value != 0
    34  }
    35  

View as plain text