Skip to content

Commit 59e60aa

Browse files
committed
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent b775942 commit 59e60aa

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

cpu/cpu_arm64.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ const cacheLineSize = 64
1010

1111
func init() {
1212
switch runtime.GOOS {
13-
case "darwin":
14-
// iOS does not seem to allow reading these registers
15-
case "android", "linux":
13+
case "android", "darwin":
14+
// Android and iOS don't seem to allow reading these registers.
15+
// Fake the minimal features expected by
16+
// TestARM64minimalFeatures.
17+
ARM64.HasASIMD = true
18+
ARM64.HasFP = true
19+
case "linux":
1620
doinit()
1721
default:
1822
readARM64Registers()

0 commit comments

Comments
 (0)