...
Run Format

Source file src/runtime/os_freebsd_arm.go

Documentation: runtime

     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  const (
     8  	_HWCAP_VFP   = 1 << 6
     9  	_HWCAP_VFPv3 = 1 << 13
    10  	_HWCAP_IDIVA = 1 << 17
    11  )
    12  
    13  var hwcap = ^uint32(0) // set by archauxv
    14  var hardDiv bool       // set if a hardware divider is available
    15  
    16  func checkgoarm() {
    17  	if goarm > 5 && hwcap&_HWCAP_VFP == 0 {
    18  		print("runtime: this CPU has no floating point hardware, so it cannot run\n")
    19  		print("this GOARM=", goarm, " binary. Recompile using GOARM=5.\n")
    20  		exit(1)
    21  	}
    22  	if goarm > 6 && hwcap&_HWCAP_VFPv3 == 0 {
    23  		print("runtime: this CPU has no VFPv3 floating point hardware, so it cannot run\n")
    24  		print("this GOARM=", goarm, " binary. Recompile using GOARM=5 or GOARM=6.\n")
    25  		exit(1)
    26  	}
    27  
    28  	// osinit not called yet, so ncpu not set: must use getncpu directly.
    29  	if getncpu() > 1 && goarm < 7 {
    30  		print("runtime: this system has multiple CPUs and must use\n")
    31  		print("atomic synchronization instructions. Recompile using GOARM=7.\n")
    32  		exit(1)
    33  	}
    34  }
    35  
    36  func archauxv(tag, val uintptr) {
    37  	switch tag {
    38  	case _AT_HWCAP: // CPU capability bit flags
    39  		hwcap = uint32(val)
    40  		hardDiv = (hwcap & _HWCAP_IDIVA) != 0
    41  	}
    42  }
    43  
    44  //go:nosplit
    45  func cputicks() int64 {
    46  	// Currently cputicks() is used in blocking profiler and to seed runtime·fastrand().
    47  	// runtime·nanotime() is a poor approximation of CPU ticks that is enough for the profiler.
    48  	// TODO: need more entropy to better seed fastrand.
    49  	return nanotime()
    50  }
    51  

View as plain text