summaryrefslogtreecommitdiffhomepage
path: root/pkg/gohacks/gohacks_unsafe.go
diff options
context:
space:
mode:
authorZach Koopmans <zkoopmans@google.com>2021-04-14 11:27:05 -0700
committergVisor bot <gvisor-bot@google.com>2021-04-14 11:28:49 -0700
commit5c1052b6bb2658208f1afaf423aeac98f30235c1 (patch)
tree7ff6b62adec989fd1ff2bd67a883fa8399174ae8 /pkg/gohacks/gohacks_unsafe.go
parent36dbd3b97dbc455c6d710f4530ec8a07474dee64 (diff)
[syserror] Remove syserror from go_marshal
PiperOrigin-RevId: 368470656
Diffstat (limited to 'pkg/gohacks/gohacks_unsafe.go')
-rw-r--r--pkg/gohacks/gohacks_unsafe.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/pkg/gohacks/gohacks_unsafe.go b/pkg/gohacks/gohacks_unsafe.go
index 10bbb1f58..374aac2b4 100644
--- a/pkg/gohacks/gohacks_unsafe.go
+++ b/pkg/gohacks/gohacks_unsafe.go
@@ -75,3 +75,17 @@ func StringFromImmutableBytes(bs []byte) string {
// strings.Builder.String().
return *(*string)(unsafe.Pointer(&bs))
}
+
+// Note that go:linkname silently doesn't work if the local name is exported,
+// necessitating an indirection for exported functions.
+
+// Memmove is runtime.memmove, exported for SeqAtomicLoad/SeqAtomicTryLoad<T>.
+//
+//go:nosplit
+func Memmove(to, from unsafe.Pointer, n uintptr) {
+ memmove(to, from, n)
+}
+
+//go:linkname memmove runtime.memmove
+//go:noescape
+func memmove(to, from unsafe.Pointer, n uintptr)