]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: initialise cpu.HWCap on netbsd/arm64
authorTobias Klauser <tklauser@distanz.ch>
Mon, 28 Sep 2020 08:11:06 +0000 (10:11 +0200)
committerTobias Klauser <tobias.klauser@gmail.com>
Mon, 28 Sep 2020 22:28:06 +0000 (22:28 +0000)
NetBSD does not supply AT_HWCAP, however we still need to initialise
cpu.HWCaps.  For now specify the bare minimum until we add some form of
capabilities detection. See
https://golang.org/issue/30824#issuecomment-494901591

Follows CL 174129 which did the same for openbsd/arm64.

Updates #30824

Change-Id: I43a86b583bc60d259a66772703de06970124bb7f
Reviewed-on: https://go-review.googlesource.com/c/go/+/257998
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Benny Siegert <bsiegert@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>

src/runtime/os_netbsd.go
src/runtime/os_netbsd_386.go
src/runtime/os_netbsd_amd64.go
src/runtime/os_netbsd_arm.go
src/runtime/os_netbsd_arm64.go

index f7f90cedc1a8b9eacd7bcd0feedd90bb1897d81a..c4c3d8e2fe1aa31539c6b70af1c3c47d6cd18815 100644 (file)
@@ -359,6 +359,7 @@ func sysargs(argc int32, argv **byte) {
        // now argv+n is auxv
        auxv := (*[1 << 28]uintptr)(add(unsafe.Pointer(argv), uintptr(n)*sys.PtrSize))
        sysauxv(auxv[:])
+       archauxv(auxv[:])
 }
 
 const (
index 037f7e36dc6ae730321f68e2b9f2c777cd49a06b..c203af9cef526121b25eed338069a7445d1ceb97 100644 (file)
@@ -14,3 +14,6 @@ func lwp_mcontext_init(mc *mcontextt, stk unsafe.Pointer, mp *m, gp *g, fn uintp
        mc.__gregs[_REG_EDX] = uint32(uintptr(unsafe.Pointer(gp)))
        mc.__gregs[_REG_ESI] = uint32(fn)
 }
+
+func archauxv(auxv []uintptr) {
+}
index 5118b0c4ffda78c82406ef194c5575f7d445cbbe..ea9d125492089283910807e3824a03c19a212a20 100644 (file)
@@ -14,3 +14,6 @@ func lwp_mcontext_init(mc *mcontextt, stk unsafe.Pointer, mp *m, gp *g, fn uintp
        mc.__gregs[_REG_R9] = uint64(uintptr(unsafe.Pointer(gp)))
        mc.__gregs[_REG_R12] = uint64(fn)
 }
+
+func archauxv(auxv []uintptr) {
+}
index b5ec23e45b0a8833154279d37920e42ad6673802..646da9dc0b489a15565c747fc673b7a745ed35ce 100644 (file)
@@ -32,3 +32,6 @@ func cputicks() int64 {
        // runtime·nanotime() is a poor approximation of CPU ticks that is enough for the profiler.
        return nanotime()
 }
+
+func archauxv(auxv []uintptr) {
+}
index 8d21b0a430f9abeecc833cf6dcb4f1e459f698b0..ae2638c778ce9f182007076f202499edc3b11b5e 100644 (file)
@@ -4,7 +4,10 @@
 
 package runtime
 
-import "unsafe"
+import (
+       "internal/cpu"
+       "unsafe"
+)
 
 func lwp_mcontext_init(mc *mcontextt, stk unsafe.Pointer, mp *m, gp *g, fn uintptr) {
        // Machine dependent mcontext initialisation for LWP.
@@ -21,3 +24,10 @@ func cputicks() int64 {
        // runtime·nanotime() is a poor approximation of CPU ticks that is enough for the profiler.
        return nanotime()
 }
+
+func archauxv(auxv []uintptr) {
+       // NetBSD does not supply AT_HWCAP, however we still need to initialise cpu.HWCaps.
+       // For now specify the bare minimum until we add some form of capabilities
+       // detection. See issue https://golang.org/issue/30824#issuecomment-494901591
+       cpu.HWCap = 1<<1 | 1<<0 // ASIMD, FP
+}