github.com/geraldss/go/src@v0.0.0-20210511222824-ac7d0ebfc235/runtime/os_freebsd_arm.go (about) 1 // Copyright 2012 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 runtime 6 7 import "internal/cpu" 8 9 const ( 10 _HWCAP_VFP = 1 << 6 11 _HWCAP_VFPv3 = 1 << 13 12 ) 13 14 func checkgoarm() { 15 if goarm > 5 && cpu.HWCap&_HWCAP_VFP == 0 { 16 print("runtime: this CPU has no floating point hardware, so it cannot run\n") 17 print("this GOARM=", goarm, " binary. Recompile using GOARM=5.\n") 18 exit(1) 19 } 20 if goarm > 6 && cpu.HWCap&_HWCAP_VFPv3 == 0 { 21 print("runtime: this CPU has no VFPv3 floating point hardware, so it cannot run\n") 22 print("this GOARM=", goarm, " binary. Recompile using GOARM=5 or GOARM=6.\n") 23 exit(1) 24 } 25 26 // osinit not called yet, so ncpu not set: must use getncpu directly. 27 if getncpu() > 1 && goarm < 7 { 28 print("runtime: this system has multiple CPUs and must use\n") 29 print("atomic synchronization instructions. Recompile using GOARM=7.\n") 30 exit(1) 31 } 32 } 33 34 func archauxv(tag, val uintptr) { 35 switch tag { 36 case _AT_HWCAP: 37 cpu.HWCap = uint(val) 38 case _AT_HWCAP2: 39 cpu.HWCap2 = uint(val) 40 } 41 } 42 43 //go:nosplit 44 func cputicks() int64 { 45 // Currently cputicks() is used in blocking profiler and to seed runtime·fastrand(). 46 // runtime·nanotime() is a poor approximation of CPU ticks that is enough for the profiler. 47 return nanotime() 48 }