Skip to content

Commit 98379d0

Browse files
committed
cpu: avoid illegal instruction on openbsd/arm64
On OpenBSD, this package tries to read a privileged register, which results in a SIGILL. Use the same workaround as Android, iOS and NetBSD. Update golang/go#31746 Change-Id: I981249310169bc30b018c1a157529a4e46597d81 Reviewed-on: https://go-review.googlesource.com/c/sys/+/263337 Trust: Tobias Klauser <[email protected]> Run-TryBot: Tobias Klauser <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Joel Sing <[email protected]>
1 parent b09fb70 commit 98379d0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cpu/cpu_arm64.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,17 @@ func initOptions() {
3939

4040
func archInit() {
4141
switch runtime.GOOS {
42-
case "android", "darwin", "ios", "netbsd":
42+
case "android", "darwin", "ios", "netbsd", "openbsd":
4343
// Android and iOS don't seem to allow reading these registers.
4444
//
4545
// NetBSD:
4646
// ID_AA64ISAR0_EL1 is a privileged register and cannot be read from EL0.
4747
// It can be read via sysctl(3). Example for future implementers:
4848
// https://nxr.netbsd.org/xref/src/usr.sbin/cpuctl/arch/aarch64.c
4949
//
50+
// OpenBSD:
51+
// See https://golang.org/issue/31746
52+
//
5053
// Fake the minimal features expected by
5154
// TestARM64minimalFeatures.
5255
ARM64.HasASIMD = true

0 commit comments

Comments
 (0)