cpu: don't read ARM64 registers on Android

It seems like on Android we're not allowed in all cases to read the
registers ISAR0, ISAR1 and PFR0 to detect CPU features.

Fixes golang/go#36622

Change-Id: I577bd928a5a4dcd6e908cf059faa15fc0c80e3e5
Reviewed-on: https://go-review.googlesource.com/c/sys/+/215237
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Tobias Klauser
2020-01-17 15:32:12 +01:00
committed by Tobias Klauser
parent b77594299b
commit 59e60aa80a

View File

@@ -10,9 +10,13 @@ const cacheLineSize = 64
func init() {
switch runtime.GOOS {
case "darwin":
// iOS does not seem to allow reading these registers
case "android", "linux":
case "android", "darwin":
// Android and iOS don't seem to allow reading these registers.
// Fake the minimal features expected by
// TestARM64minimalFeatures.
ARM64.HasASIMD = true
ARM64.HasFP = true
case "linux":
doinit()
default:
readARM64Registers()