Matteo Scandolo | a6a3aee | 2019-11-26 13:30:14 -0700 | [diff] [blame] | 1 | // Copyright 2015 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
David K. Bainbridge | c415efe | 2021-08-19 13:05:21 +0000 | [diff] [blame] | 5 | //go:build gccgo && !aix |
| 6 | // +build gccgo,!aix |
Matteo Scandolo | a6a3aee | 2019-11-26 13:30:14 -0700 | [diff] [blame] | 7 | |
| 8 | package unix |
| 9 | |
| 10 | import "syscall" |
| 11 | |
| 12 | // We can't use the gc-syntax .s files for gccgo. On the plus side |
| 13 | // much of the functionality can be written directly in Go. |
| 14 | |
Matteo Scandolo | a6a3aee | 2019-11-26 13:30:14 -0700 | [diff] [blame] | 15 | func realSyscallNoError(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r uintptr) |
| 16 | |
Matteo Scandolo | a6a3aee | 2019-11-26 13:30:14 -0700 | [diff] [blame] | 17 | func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr) |
| 18 | |
| 19 | func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) { |
| 20 | syscall.Entersyscall() |
| 21 | r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) |
| 22 | syscall.Exitsyscall() |
| 23 | return r, 0 |
| 24 | } |
| 25 | |
| 26 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { |
| 27 | syscall.Entersyscall() |
| 28 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) |
| 29 | syscall.Exitsyscall() |
| 30 | return r, 0, syscall.Errno(errno) |
| 31 | } |
| 32 | |
| 33 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { |
| 34 | syscall.Entersyscall() |
| 35 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) |
| 36 | syscall.Exitsyscall() |
| 37 | return r, 0, syscall.Errno(errno) |
| 38 | } |
| 39 | |
| 40 | func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) { |
| 41 | syscall.Entersyscall() |
| 42 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9) |
| 43 | syscall.Exitsyscall() |
| 44 | return r, 0, syscall.Errno(errno) |
| 45 | } |
| 46 | |
| 47 | func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) { |
| 48 | r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) |
| 49 | return r, 0 |
| 50 | } |
| 51 | |
| 52 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { |
| 53 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) |
| 54 | return r, 0, syscall.Errno(errno) |
| 55 | } |
| 56 | |
| 57 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { |
| 58 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) |
| 59 | return r, 0, syscall.Errno(errno) |
| 60 | } |