github.com/guyezi/gofrontend@v0.0.0-20200228202240-7a62a49e62c0/libgo/go/internal/cpu/cpu_arm.go (about) 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 // arm doesn't have a 'cpuid' equivalent, so we rely on HWCAP/HWCAP2. 8 // These are linknamed in runtime/os_(linux|freebsd)_arm.go and are 9 // initialized by archauxv(). 10 // These should not be changed after they are initialized. 11 var HWCap uint 12 var HWCap2 uint 13 14 // HWCAP/HWCAP2 bits. These are exposed by Linux and FreeBSD. 15 const ( 16 hwcap_VFPv4 = 1 << 16 17 hwcap_IDIVA = 1 << 17 18 ) 19 20 func doinit() { 21 options = []option{ 22 {Name: "vfpv4", Feature: &ARM.HasVFPv4}, 23 {Name: "idiva", Feature: &ARM.HasIDIVA}, 24 } 25 26 // HWCAP feature bits 27 ARM.HasVFPv4 = isSet(HWCap, hwcap_VFPv4) 28 ARM.HasIDIVA = isSet(HWCap, hwcap_IDIVA) 29 } 30 31 func isSet(hwc uint, value uint) bool { 32 return hwc&value != 0 33 }