mirror of
https://github.com/golang/sys.git
synced 2026-02-07 19:26:03 +03:00
In Go 1.17 we will introduce a register-based ABI on some platforms, as well as ABI wrappers to bridge the ABIs. For Darwin syscall wrappers, it needs to be called directly, instead of through wrappers. Currently, it is written as that the syscall functions are defined in assembly and their addresses are taken from Go using funcPC. In Go 1.17 this will result in the address of the ABI wrapper, which is undesired. In the syscall package in the standard library we changed to use a compiler intrinsic internal/abi.FuncPCABI0 to take the address of the syscall function. But that is not available to this repo and not available in older versions of Go. Here we take a different approach: taking the address directly from assembly. This also ensures we get the address of the defined syscall function, not the ABI wrapper. Updates golang/go#45702. Change-Id: Ia7480d0fb0ca4fb9bf2f36d2deb1e3e5e4eb8284 Reviewed-on: https://go-review.googlesource.com/c/sys/+/317894 Trust: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
28 lines
1.2 KiB
Go
28 lines
1.2 KiB
Go
// Copyright 2018 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.
|
|
|
|
//go:build darwin && go1.12
|
|
// +build darwin,go1.12
|
|
|
|
package unix
|
|
|
|
import _ "unsafe"
|
|
|
|
// Implemented in the runtime package (runtime/sys_darwin.go)
|
|
func syscall_syscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
|
|
func syscall_syscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
|
|
func syscall_syscall6X(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
|
|
func syscall_syscall9(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) // 32-bit only
|
|
func syscall_rawSyscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
|
|
func syscall_rawSyscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
|
|
func syscall_syscallPtr(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
|
|
|
|
//go:linkname syscall_syscall syscall.syscall
|
|
//go:linkname syscall_syscall6 syscall.syscall6
|
|
//go:linkname syscall_syscall6X syscall.syscall6X
|
|
//go:linkname syscall_syscall9 syscall.syscall9
|
|
//go:linkname syscall_rawSyscall syscall.rawSyscall
|
|
//go:linkname syscall_rawSyscall6 syscall.rawSyscall6
|
|
//go:linkname syscall_syscallPtr syscall.syscallPtr
|