aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/os_netbsd_arm64.go
diff options
context:
space:
mode:
authorMaya Rashish <maya@netbsd.org>2019-04-20 14:39:33 +0000
committerBenny Siegert <bsiegert@gmail.com>2019-04-20 15:02:01 +0000
commitd23cba683e59f6092c1e3f676c8e83e7973f27dd (patch)
tree4aa09c72d160cfe228ca01d667c1d667d77249a6 /src/runtime/os_netbsd_arm64.go
parent78f0de10eccf3606dbc4b854a4cd3a7e502edc07 (diff)
downloadgo-d23cba683e59f6092c1e3f676c8e83e7973f27dd.tar.gz
go-d23cba683e59f6092c1e3f676c8e83e7973f27dd.zip
all: add start of netbsd/arm64 support
This works well enough to run some code natively on arm64, but not well enough for more complicated code. I've been suggested to start a pull request anyway. Updates #30824 Change-Id: Ib4f63e0e8a9edfc862cf65b5f1b0fbf9a8a1628e GitHub-Last-Rev: b01b105e0446e349c8d9895d3ac6918fa0cdc48c GitHub-Pull-Request: golang/go#29398 Reviewed-on: https://go-review.googlesource.com/c/go/+/155739 Run-TryBot: Benny Siegert <bsiegert@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Diffstat (limited to 'src/runtime/os_netbsd_arm64.go')
-rw-r--r--src/runtime/os_netbsd_arm64.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/runtime/os_netbsd_arm64.go b/src/runtime/os_netbsd_arm64.go
new file mode 100644
index 0000000000..fd81eb7557
--- /dev/null
+++ b/src/runtime/os_netbsd_arm64.go
@@ -0,0 +1,24 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package runtime
+
+import "unsafe"
+
+func lwp_mcontext_init(mc *mcontextt, stk unsafe.Pointer, mp *m, gp *g, fn uintptr) {
+ // Machine dependent mcontext initialisation for LWP.
+ mc.__gregs[_REG_ELR] = uint64(funcPC(lwp_tramp))
+ mc.__gregs[_REG_X31] = uint64(uintptr(stk))
+ mc.__gregs[_REG_X0] = uint64(uintptr(unsafe.Pointer(mp)))
+ mc.__gregs[_REG_X1] = uint64(uintptr(unsafe.Pointer(mp.g0)))
+ mc.__gregs[_REG_X2] = uint64(fn)
+}
+
+//go:nosplit
+func cputicks() int64 {
+ // Currently cputicks() is used in blocking profiler and to seed runtime·fastrand().
+ // runtime·nanotime() is a poor approximation of CPU ticks that is enough for the profiler.
+ // TODO: need more entropy to better seed fastrand.
+ return nanotime()
+}