github.com/twelsh-aw/go/src@v0.0.0-20230516233729-a56fe86a7c81/runtime/os_linux_arm.go (about)

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