Skip to content

Commit a91c4d2

Browse files
committed
unix: add support for freebsd/arm64
This wasn't actually generated on freebsd/arm64 yet. It's mostly a copy of the amd64 files for now. Updates golang/go#24715 Change-Id: If24c3c5803a4708f0b26d738f690cbea1694ca88 Reviewed-on: https://go-review.googlesource.com/c/155978 Run-TryBot: Tobias Klauser <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 9a3f9b0 commit a91c4d2

7 files changed

+4892
-0
lines changed

unix/asm_freebsd_arm64.s

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2018 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, FreeBSD
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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ freebsd_arm)
121121
# API consistent across platforms.
122122
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
123123
;;
124+
freebsd_arm64)
125+
mkerrors="$mkerrors -m64"
126+
mksysnum="go run mksysnum.go 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'"
127+
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
128+
;;
124129
netbsd_386)
125130
mkerrors="$mkerrors -m32"
126131
mksyscall="go run mksyscall.go -l32 -netbsd"

unix/syscall_freebsd_arm64.go

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright 2018 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,freebsd
6+
7+
package unix
8+
9+
import (
10+
"syscall"
11+
"unsafe"
12+
)
13+
14+
func setTimespec(sec, nsec int64) Timespec {
15+
return Timespec{Sec: sec, Nsec: nsec}
16+
}
17+
18+
func setTimeval(sec, usec int64) Timeval {
19+
return Timeval{Sec: sec, Usec: usec}
20+
}
21+
22+
func SetKevent(k *Kevent_t, fd, mode, flags int) {
23+
k.Ident = uint64(fd)
24+
k.Filter = int16(mode)
25+
k.Flags = uint16(flags)
26+
}
27+
28+
func (iov *Iovec) SetLen(length int) {
29+
iov.Len = uint64(length)
30+
}
31+
32+
func (msghdr *Msghdr) SetControllen(length int) {
33+
msghdr.Controllen = uint32(length)
34+
}
35+
36+
func (cmsg *Cmsghdr) SetLen(length int) {
37+
cmsg.Len = uint32(length)
38+
}
39+
40+
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
41+
var writtenOut uint64 = 0
42+
_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0)
43+
44+
written = int(writtenOut)
45+
46+
if e1 != 0 {
47+
err = e1
48+
}
49+
return
50+
}
51+
52+
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)

0 commit comments

Comments
 (0)