-
Notifications
You must be signed in to change notification settings - Fork 17.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
syscall: add syscall support for openbsd/riscv64 port
Updates #55999 Change-Id: I5b8452207e951e543b9be42ebcb7d62c0c023f08 Reviewed-on: https://go-review.googlesource.com/c/go/+/518627 Reviewed-by: Ian Lance Taylor <[email protected]> Run-TryBot: Joel Sing <[email protected]> Reviewed-by: Michael Pratt <[email protected]> Reviewed-by: Aaron Bieber <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
- Loading branch information
Showing
8 changed files
with
4,617 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright 2023 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. | ||
|
||
#include "textflag.h" | ||
|
||
// | ||
// System call support for RISCV64, OpenBSD | ||
// | ||
|
||
// Provide these function names via assembly so they are provided as ABI0, | ||
// rather than ABIInternal. | ||
|
||
// func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) | ||
TEXT ·Syscall(SB),NOSPLIT,$0-56 | ||
JMP ·syscallInternal(SB) | ||
|
||
// func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) | ||
TEXT ·Syscall6(SB),NOSPLIT,$0-80 | ||
JMP ·syscall6Internal(SB) | ||
|
||
// func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) | ||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56 | ||
JMP ·rawSyscallInternal(SB) | ||
|
||
// func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) | ||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 | ||
JMP ·rawSyscall6Internal(SB) | ||
|
||
// func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) | ||
TEXT ·Syscall9(SB),NOSPLIT,$0-104 | ||
JMP ·syscall9Internal(SB) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright 2023 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 syscall | ||
|
||
func setTimespec(sec, nsec int64) Timespec { | ||
return Timespec{Sec: sec, Nsec: nsec} | ||
} | ||
|
||
func setTimeval(sec, usec int64) Timeval { | ||
return Timeval{Sec: sec, Usec: usec} | ||
} | ||
|
||
func SetKevent(k *Kevent_t, fd, mode, flags int) { | ||
k.Ident = uint64(fd) | ||
k.Filter = int16(mode) | ||
k.Flags = uint16(flags) | ||
} | ||
|
||
func (iov *Iovec) SetLen(length int) { | ||
iov.Len = uint64(length) | ||
} | ||
|
||
func (msghdr *Msghdr) SetControllen(length int) { | ||
msghdr.Controllen = uint32(length) | ||
} | ||
|
||
func (cmsg *Cmsghdr) SetLen(length int) { | ||
cmsg.Len = uint32(length) | ||
} | ||
|
||
// RTM_LOCK only exists in OpenBSD 6.3 and earlier. | ||
const RTM_LOCK = 0x8 | ||
|
||
// SYS___SYSCTL only exists in OpenBSD 5.8 and earlier, when it was | ||
// was renamed to SYS_SYSCTL. | ||
const SYS___SYSCTL = SYS_SYSCTL |
Oops, something went wrong.