aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/os_linux_arm64.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2018-08-08 17:26:23 -0700
committerIan Lance Taylor <iant@golang.org>2018-08-21 14:36:09 +0000
commitcd7cb86d8e56d28bfe9bd522baa44c95127028d7 (patch)
treed22fd63b44b0843dca3ab432621a416d56339103 /src/runtime/os_linux_arm64.go
parent4e1b11e2c9bdb0ddea1141eed487be1a626ff5be (diff)
downloadgo-cd7cb86d8e56d28bfe9bd522baa44c95127028d7.tar.gz
go-cd7cb86d8e56d28bfe9bd522baa44c95127028d7.zip
runtime: don't use linkname to refer to internal/cpu
The runtime package already imports the internal/cpu package, so there is no reason for it to use go:linkname comments to refer to internal/cpu functions and variables. Since internal/cpu is internal, we can just export those names. Removing the obscurity of go:linkname outweighs the minor additional complexity added to the internal/cpu API. Change-Id: Id89951b7f3fc67cd9bce67ac6d01d44a647a10ad Reviewed-on: https://go-review.googlesource.com/128755 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Martin Möhrmann <moehrmann@google.com>
Diffstat (limited to 'src/runtime/os_linux_arm64.go')
-rw-r--r--src/runtime/os_linux_arm64.go19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/runtime/os_linux_arm64.go b/src/runtime/os_linux_arm64.go
index 28a0319f10..cbe528b4af 100644
--- a/src/runtime/os_linux_arm64.go
+++ b/src/runtime/os_linux_arm64.go
@@ -6,20 +6,10 @@
package runtime
-// For go:linkname
-import _ "unsafe"
+import "internal/cpu"
var randomNumber uint32
-// arm64 doesn't have a 'cpuid' instruction equivalent and relies on
-// HWCAP/HWCAP2 bits for hardware capabilities.
-
-//go:linkname cpu_hwcap internal/cpu.hwcap
-var cpu_hwcap uint
-
-//go:linkname cpu_hwcap2 internal/cpu.hwcap2
-var cpu_hwcap2 uint
-
func archauxv(tag, val uintptr) {
switch tag {
case _AT_RANDOM:
@@ -28,10 +18,13 @@ func archauxv(tag, val uintptr) {
// it as a byte array.
randomNumber = uint32(startupRandomData[4]) | uint32(startupRandomData[5])<<8 |
uint32(startupRandomData[6])<<16 | uint32(startupRandomData[7])<<24
+
case _AT_HWCAP:
- cpu_hwcap = uint(val)
+ // arm64 doesn't have a 'cpuid' instruction equivalent and relies on
+ // HWCAP/HWCAP2 bits for hardware capabilities.
+ cpu.HWCap = uint(val)
case _AT_HWCAP2:
- cpu_hwcap2 = uint(val)
+ cpu.HWCap2 = uint(val)
}
}