github.com/x04/go/src@v0.0.0-20200202162449-3d481ceb3525/runtime/os_linux_arm64.go (about) 1 // Copyright 2015 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 // +build arm64 6 7 package runtime 8 9 import "github.com/x04/go/src/internal/cpu" 10 11 func archauxv(tag, val uintptr) { 12 switch tag { 13 case _AT_HWCAP: 14 // arm64 doesn't have a 'cpuid' instruction equivalent and relies on 15 // HWCAP/HWCAP2 bits for hardware capabilities. 16 hwcap := uint(val) 17 if GOOS == "android" { 18 // The Samsung S9+ kernel reports support for atomics, but not all cores 19 // actually support them, resulting in SIGILL. See issue #28431. 20 // TODO(elias.naur): Only disable the optimization on bad chipsets. 21 const hwcap_ATOMICS = 1 << 8 22 hwcap &= ^uint(hwcap_ATOMICS) 23 } 24 cpu.HWCap = hwcap 25 case _AT_HWCAP2: 26 cpu.HWCap2 = uint(val) 27 } 28 } 29 30 func osArchInit() {} 31 32 //go:nosplit 33 func cputicks() int64 { 34 // Currently cputicks() is used in blocking profiler and to seed fastrand(). 35 // nanotime() is a poor approximation of CPU ticks that is enough for the profiler. 36 return nanotime() 37 }