1// Copyright 2009 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 5package runtime 6 7import "internal/cpu" 8 9const ( 10 _HWCAP_VFP = 1 << 6 // introduced in at least 2.6.11 11 _HWCAP_VFPv3 = 1 << 13 // introduced in 2.6.30 12) 13 14func checkgoarm() { 15 // On Android, /proc/self/auxv might be unreadable and hwcap won't 16 // reflect the CPU capabilities. Assume that every Android arm device 17 // has the necessary floating point hardware available. 18 if GOOS == "android" { 19 return 20 } 21 if goarm > 5 && cpu.HWCap&_HWCAP_VFP == 0 { 22 print("runtime: this CPU has no floating point hardware, so it cannot run\n") 23 print("this GOARM=", goarm, " binary. Recompile using GOARM=5.\n") 24 exit(1) 25 } 26 if goarm > 6 && cpu.HWCap&_HWCAP_VFPv3 == 0 { 27 print("runtime: this CPU has no VFPv3 floating point hardware, so it cannot run\n") 28 print("this GOARM=", goarm, " binary. Recompile using GOARM=5 or GOARM=6.\n") 29 exit(1) 30 } 31} 32 33func archauxv(tag, val uintptr) { 34 switch tag { 35 case _AT_HWCAP: 36 cpu.HWCap = uint(val) 37 case _AT_HWCAP2: 38 cpu.HWCap2 = uint(val) 39 } 40} 41 42func osArchInit() {} 43 44//go:nosplit 45func cputicks() int64 { 46 // Currently cputicks() is used in blocking profiler and to seed fastrand(). 47 // nanotime() is a poor approximation of CPU ticks that is enough for the profiler. 48 return nanotime() 49} 50