Skip to content

Commit 4347357

Browse files
4a6f656cbradfitz
authored andcommitted
unix: add support for openbsd/arm64
Generated on OpenBSD 6.5. Updates golang/go#31656 Change-Id: Ie8b5a8ae5ed25517aae2712fa27e62d385813f21 Reviewed-on: https://go-review.googlesource.com/c/sys/+/173678 Reviewed-by: Brad Fitzpatrick <[email protected]> Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 8296894 commit 4347357

8 files changed

+4612
-0
lines changed

unix/asm_openbsd_arm64.s

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2019 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+
5+
// +build !gccgo
6+
7+
#include "textflag.h"
8+
9+
//
10+
// System call support for arm64, OpenBSD
11+
//
12+
13+
// Just jump to package syscall's implementation for all these functions.
14+
// The runtime may know about them.
15+
16+
TEXT ·Syscall(SB),NOSPLIT,$0-56
17+
JMP syscall·Syscall(SB)
18+
19+
TEXT ·Syscall6(SB),NOSPLIT,$0-80
20+
JMP syscall·Syscall6(SB)
21+
22+
TEXT ·Syscall9(SB),NOSPLIT,$0-104
23+
JMP syscall·Syscall9(SB)
24+
25+
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
26+
JMP syscall·RawSyscall(SB)
27+
28+
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
29+
JMP syscall·RawSyscall6(SB)

unix/mkall.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,15 @@ openbsd_arm)
169169
# API consistent across platforms.
170170
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
171171
;;
172+
openbsd_arm64)
173+
mkerrors="$mkerrors -m64"
174+
mksyscall="go run mksyscall.go -openbsd"
175+
mksysctl="./mksysctl_openbsd.pl"
176+
mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
177+
# Let the type of C char be signed for making the bare syscall
178+
# API consistent across platforms.
179+
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
180+
;;
172181
solaris_amd64)
173182
mksyscall="go run mksyscall_solaris.go"
174183
mkerrors="$mkerrors -m64"

unix/syscall_openbsd_arm64.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright 2019 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+
5+
// +build arm64,openbsd
6+
7+
package unix
8+
9+
func setTimespec(sec, nsec int64) Timespec {
10+
return Timespec{Sec: sec, Nsec: nsec}
11+
}
12+
13+
func setTimeval(sec, usec int64) Timeval {
14+
return Timeval{Sec: sec, Usec: usec}
15+
}
16+
17+
func SetKevent(k *Kevent_t, fd, mode, flags int) {
18+
k.Ident = uint64(fd)
19+
k.Filter = int16(mode)
20+
k.Flags = uint16(flags)
21+
}
22+
23+
func (iov *Iovec) SetLen(length int) {
24+
iov.Len = uint64(length)
25+
}
26+
27+
func (msghdr *Msghdr) SetControllen(length int) {
28+
msghdr.Controllen = uint32(length)
29+
}
30+
31+
func (cmsg *Cmsghdr) SetLen(length int) {
32+
cmsg.Len = uint32(length)
33+
}
34+
35+
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
36+
// of openbsd/amd64 the syscall is called sysctl instead of __sysctl.
37+
const SYS___SYSCTL = SYS_SYSCTL

0 commit comments

Comments
 (0)