aboutsummaryrefslogtreecommitdiff
path: root/src/syscall/syscall_linux.go
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2022-02-24 16:46:54 -0500
committerMichael Pratt <mpratt@google.com>2022-04-21 18:07:03 +0000
commitf7b12ff6fbad25ea30ae9f16dd1443eb9b76766d (patch)
tree5e8f03f34586130cca2ab9281ab492b6a5c148ea /src/syscall/syscall_linux.go
parent15602e88658a9dd43cec4220e01ef408d273f028 (diff)
downloadgo-f7b12ff6fbad25ea30ae9f16dd1443eb9b76766d.tar.xz
syscall: define RawSyscall in terms of RawSyscall6 on linux
For #51087 Change-Id: I63e07638507328efe33dbf7dd5f8a8b78890e037 Reviewed-on: https://go-review.googlesource.com/c/go/+/388476 Run-TryBot: Michael Pratt <mpratt@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/syscall/syscall_linux.go')
-rw-r--r--src/syscall/syscall_linux.go22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/syscall/syscall_linux.go b/src/syscall/syscall_linux.go
index b0e2cdb682..a9a8ecbefd 100644
--- a/src/syscall/syscall_linux.go
+++ b/src/syscall/syscall_linux.go
@@ -18,7 +18,6 @@ import (
func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
-func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
// N.B. RawSyscall6 is provided via linkname by runtime/internal/syscall.
//
@@ -27,6 +26,27 @@ func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
+// N.B. For the Syscall functions below:
+//
+// //go:uintptrkeepalive because the uintptr argument may be converted pointers
+// that need to be kept alive in the caller (this is implied for RawSyscall6
+// since it has no body).
+//
+// //go:nosplit because stack copying does not account for uintptrkeepalive, so
+// the stack must not grow. Stack copying cannot blindly assume that all
+// uintptr arguments are pointers, because some values may look like pointers,
+// but not really be pointers, and adjusting their value would break the call.
+//
+// //go:linkname to ensure ABI wrappers are generated for external callers
+// (notably x/sys/unix assembly).
+
+//go:uintptrkeepalive
+//go:nosplit
+//go:linkname RawSyscall
+func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) {
+ return RawSyscall6(trap, a1, a2, a3, 0, 0, 0)
+}
+
func rawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr)
/*