Source file src/runtime/os_freebsd_arm.go

     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 (
     8  	"internal/cpu"
     9  	"unsafe"
    10  )
    11  
    12  const (
    13  	_HWCAP_VFP   = 1 << 6
    14  	_HWCAP_VFPv3 = 1 << 13
    15  )
    16  
    17  func checkgoarm() {
    18  	if cpu.HWCap&_HWCAP_VFP == 0 && goarmsoftfp == 0 {
    19  		print("runtime: this CPU has no floating point hardware, so it cannot run\n")
    20  		print("a binary compiled for hard floating point. Recompile adding ,softfloat\n")
    21  		print("to GOARM.\n")
    22  		exit(1)
    23  	}
    24  	if goarm > 6 && cpu.HWCap&_HWCAP_VFPv3 == 0 && goarmsoftfp == 0 {
    25  		print("runtime: this CPU has no VFPv3 floating point hardware, so it cannot run\n")
    26  		print("a binary compiled for VFPv3 hard floating point. Recompile adding ,softfloat\n")
    27  		print("to GOARM or changing GOARM to 6.\n")
    28  		exit(1)
    29  	}
    30  
    31  	// osinit not called yet, so ncpu not set: must use getncpu directly.
    32  	if getncpu() > 1 && goarm < 7 {
    33  		print("runtime: this system has multiple CPUs and must use\n")
    34  		print("atomic synchronization instructions. Recompile using GOARM=7.\n")
    35  		exit(1)
    36  	}
    37  }
    38  
    39  func archauxv(tag, val uintptr) {
    40  	switch tag {
    41  	case _AT_HWCAP:
    42  		cpu.HWCap = uint(val)
    43  	case _AT_HWCAP2:
    44  		cpu.HWCap2 = uint(val)
    45  	case _AT_PLATFORM:
    46  		cpu.Platform = gostringnocopy((*byte)(unsafe.Pointer(val)))
    47  	}
    48  }
    49  
    50  //go:nosplit
    51  func cputicks() int64 {
    52  	// runtime·nanotime() is a poor approximation of CPU ticks that is enough for the profiler.
    53  	return nanotime()
    54  }
    55  

View as plain text