...

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 linknamed in runtime/os_(linux|freebsd)_arm.go and are
    11	// initialized by archauxv().
    12	// These should not be changed after they are initialized.
    13	var HWCap uint
    14	var HWCap2 uint
    15	
    16	// HWCAP/HWCAP2 bits. These are exposed by Linux and FreeBSD.
    17	const (
    18		hwcap_VFPv4 = 1 << 16
    19		hwcap_IDIVA = 1 << 17
    20	)
    21	
    22	func doinit() {
    23		options = []option{
    24			{Name: "vfpv4", Feature: &ARM.HasVFPv4},
    25			{Name: "idiva", Feature: &ARM.HasIDIVA},
    26		}
    27	
    28		// HWCAP feature bits
    29		ARM.HasVFPv4 = isSet(HWCap, hwcap_VFPv4)
    30		ARM.HasIDIVA = isSet(HWCap, hwcap_IDIVA)
    31	}
    32	
    33	func isSet(hwc uint, value uint) bool {
    34		return hwc&value != 0
    35	}
    36	

View as plain text