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>
Tobias Klauser authored 4 years ago
Tobias Klauser committed 4 years ago
9 | 9 | |
10 | 10 | func init() { |
11 | 11 | switch runtime.GOOS { |
12 | case "darwin": | |
13 | // iOS does not seem to allow reading these registers | |
14 | case "android", "linux": | |
12 | case "android", "darwin": | |
13 | // Android and iOS don't seem to allow reading these registers. | |
14 | // Fake the minimal features expected by | |
15 | // TestARM64minimalFeatures. | |
16 | ARM64.HasASIMD = true | |
17 | ARM64.HasFP = true | |
18 | case "linux": | |
15 | 19 | doinit() |
16 | 20 | default: |
17 | 21 | readARM64Registers() |