aboutsummaryrefslogtreecommitdiff
path: root/src/syscall
diff options
context:
space:
mode:
authorRick Hudson <rlh@golang.org>2016-04-27 18:19:16 -0400
committerRick Hudson <rlh@golang.org>2016-04-27 18:46:52 -0400
commit23aeb34df172b17b7bfaa85fb59ca64bef9073bb (patch)
treea8ab866f1e50f0059856ce628f036d93ab620155 /src/syscall
parent1354b32cd70f2702381764fd595dd2faa996840c (diff)
parentd3c79d324acd7300b6f705e66af8ca711af00d9f (diff)
downloadgo-23aeb34df172b17b7bfaa85fb59ca64bef9073bb.tar.xz
[dev.garbage] Merge remote-tracking branch 'origin/master' into HEAD
Change-Id: I282fd9ce9db435dfd35e882a9502ab1abc185297
Diffstat (limited to 'src/syscall')
-rw-r--r--src/syscall/asm_linux_s390x.s156
-rw-r--r--src/syscall/mksyscall_windows.go4
-rw-r--r--src/syscall/sockcmsg_unix.go2
-rw-r--r--src/syscall/types_linux.go3
-rw-r--r--src/syscall/ztypes_linux_ppc64.go7
-rw-r--r--src/syscall/ztypes_linux_ppc64le.go7
6 files changed, 170 insertions, 9 deletions
diff --git a/src/syscall/asm_linux_s390x.s b/src/syscall/asm_linux_s390x.s
new file mode 100644
index 0000000000..e22a92b966
--- /dev/null
+++ b/src/syscall/asm_linux_s390x.s
@@ -0,0 +1,156 @@
+// Copyright 2016 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 calls for s390x, Linux
+//
+
+// func Syscall(trap int64, a1, a2, a3 int64) (r1, r2, err int64)
+TEXT ·Syscall(SB),NOSPLIT,$0-56
+ BL runtime·entersyscall(SB)
+ MOVD a1+8(FP), R2
+ MOVD a2+16(FP), R3
+ MOVD a3+24(FP), R4
+ MOVD $0, R5
+ MOVD $0, R6
+ MOVD $0, R7
+ MOVD trap+0(FP), R1 // syscall entry
+ SYSCALL
+ MOVD $0xfffffffffffff001, R8
+ CMPUBLT R2, R8, ok
+ MOVD $-1, r1+32(FP)
+ MOVD $0, r2+40(FP)
+ NEG R2, R2
+ MOVD R2, err+48(FP) // errno
+ BL runtime·exitsyscall(SB)
+ RET
+ok:
+ MOVD R2, r1+32(FP)
+ MOVD R3, r2+40(FP)
+ MOVD $0, err+48(FP) // errno
+ BL runtime·exitsyscall(SB)
+ RET
+
+// func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
+TEXT ·Syscall6(SB),NOSPLIT,$0-80
+ BL runtime·entersyscall(SB)
+ MOVD a1+8(FP), R2
+ MOVD a2+16(FP), R3
+ MOVD a3+24(FP), R4
+ MOVD a4+32(FP), R5
+ MOVD a5+40(FP), R6
+ MOVD a6+48(FP), R7
+ MOVD trap+0(FP), R1 // syscall entry
+ SYSCALL
+ MOVD $0xfffffffffffff001, R8
+ CMPUBLT R2, R8, ok6
+ MOVD $-1, r1+56(FP)
+ MOVD $0, r2+64(FP)
+ NEG R2, R2
+ MOVD R2, err+72(FP) // errno
+ BL runtime·exitsyscall(SB)
+ RET
+ok6:
+ MOVD R2, r1+56(FP)
+ MOVD R3, r2+64(FP)
+ MOVD $0, err+72(FP) // errno
+ BL runtime·exitsyscall(SB)
+ RET
+
+// func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
+TEXT ·RawSyscall(SB),NOSPLIT,$0-56
+ MOVD a1+8(FP), R2
+ MOVD a2+16(FP), R3
+ MOVD a3+24(FP), R4
+ MOVD $0, R5
+ MOVD $0, R6
+ MOVD $0, R7
+ MOVD trap+0(FP), R1 // syscall entry
+ SYSCALL
+ MOVD $0xfffffffffffff001, R8
+ CMPUBLT R2, R8, ok1
+ MOVD $-1, r1+32(FP)
+ MOVD $0, r2+40(FP)
+ NEG R2, R2
+ MOVD R2, err+48(FP) // errno
+ RET
+ok1:
+ MOVD R2, r1+32(FP)
+ MOVD R3, r2+40(FP)
+ MOVD $0, err+48(FP) // errno
+ RET
+
+// func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
+TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
+ MOVD a1+8(FP), R2
+ MOVD a2+16(FP), R3
+ MOVD a3+24(FP), R4
+ MOVD a4+32(FP), R5
+ MOVD a5+40(FP), R6
+ MOVD a6+48(FP), R7
+ MOVD trap+0(FP), R1 // syscall entry
+ SYSCALL
+ MOVD $0xfffffffffffff001, R8
+ CMPUBLT R2, R8, ok2
+ MOVD $-1, r1+56(FP)
+ MOVD $0, r2+64(FP)
+ NEG R2, R2
+ MOVD R2, err+72(FP) // errno
+ RET
+ok2:
+ MOVD R2, r1+56(FP)
+ MOVD R3, r2+64(FP)
+ MOVD $0, err+72(FP) // errno
+ RET
+
+#define SYS_SOCKETCALL 102 /* from zsysnum_linux_s390x.go */
+
+// func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err int)
+// Kernel interface gets call sub-number and pointer to a0.
+TEXT ·socketcall(SB),NOSPLIT,$0-72
+ BL runtime·entersyscall(SB)
+ MOVD $SYS_SOCKETCALL, R1 // syscall entry
+ MOVD call+0(FP), R2 // socket call number
+ MOVD $a0+8(FP), R3 // pointer to call arguments
+ MOVD $0, R4
+ MOVD $0, R5
+ MOVD $0, R6
+ MOVD $0, R7
+ SYSCALL
+ MOVD $0xfffffffffffff001, R8
+ CMPUBLT R2, R8, oksock
+ MOVD $-1, n+56(FP)
+ NEG R2, R2
+ MOVD R2, err+64(FP)
+ BL runtime·exitsyscall(SB)
+ RET
+oksock:
+ MOVD R2, n+56(FP)
+ MOVD $0, err+64(FP)
+ CALL runtime·exitsyscall(SB)
+ RET
+
+// func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err int)
+// Kernel interface gets call sub-number and pointer to a0.
+TEXT ·rawsocketcall(SB),NOSPLIT,$0-72
+ MOVD $SYS_SOCKETCALL, R1 // syscall entry
+ MOVD call+0(FP), R2 // socket call number
+ MOVD $a0+8(FP), R3 // pointer to call arguments
+ MOVD $0, R4
+ MOVD $0, R5
+ MOVD $0, R6
+ MOVD $0, R7
+ SYSCALL
+ MOVD $0xfffffffffffff001, R8
+ CMPUBLT R2, R8, oksock1
+ MOVD $-1, n+56(FP)
+ NEG R2, R2
+ MOVD R2, err+64(FP)
+ RET
+oksock1:
+ MOVD R2, n+56(FP)
+ MOVD $0, err+64(FP)
+ RET
diff --git a/src/syscall/mksyscall_windows.go b/src/syscall/mksyscall_windows.go
index 7786d1349e..a6cef6fca7 100644
--- a/src/syscall/mksyscall_windows.go
+++ b/src/syscall/mksyscall_windows.go
@@ -707,9 +707,9 @@ func (src *Source) Generate(w io.Writer) error {
}
if *sysRepo {
if packageName == "windows" {
- return "&LazyDLL{Name: " + arg + ", System: true}"
+ return "NewLazySystemDLL(" + arg + ")"
} else {
- return "&windows.LazyDLL{Name: " + arg + ", System: true}"
+ return "windows.NewLazySystemDLL(" + arg + ")"
}
} else {
return syscalldot() + "NewLazyDLL(" + arg + ")"
diff --git a/src/syscall/sockcmsg_unix.go b/src/syscall/sockcmsg_unix.go
index b7a7c83286..bc4caf54a2 100644
--- a/src/syscall/sockcmsg_unix.go
+++ b/src/syscall/sockcmsg_unix.go
@@ -62,7 +62,7 @@ func ParseSocketControlMessage(b []byte) ([]SocketControlMessage, error) {
func socketControlMessageHeaderAndData(b []byte) (*Cmsghdr, []byte, error) {
h := (*Cmsghdr)(unsafe.Pointer(&b[0]))
- if h.Len < SizeofCmsghdr || int(h.Len) > len(b) {
+ if h.Len < SizeofCmsghdr || uint64(h.Len) > uint64(len(b)) {
return nil, nil, EINVAL
}
return h, b[cmsgAlignOf(SizeofCmsghdr):h.Len], nil
diff --git a/src/syscall/types_linux.go b/src/syscall/types_linux.go
index 9bccfcabd8..28d0225cbf 100644
--- a/src/syscall/types_linux.go
+++ b/src/syscall/types_linux.go
@@ -117,6 +117,9 @@ struct my_epoll_event {
// alignment requirements of EABI
int32_t padFd;
#endif
+#ifdef __powerpc64__
+ int32_t _padFd;
+#endif
int32_t fd;
int32_t pad;
};
diff --git a/src/syscall/ztypes_linux_ppc64.go b/src/syscall/ztypes_linux_ppc64.go
index 33d1b7f3e5..915ca95190 100644
--- a/src/syscall/ztypes_linux_ppc64.go
+++ b/src/syscall/ztypes_linux_ppc64.go
@@ -574,9 +574,10 @@ type Ustat_t struct {
}
type EpollEvent struct {
- Events uint32
- Fd int32
- Pad int32
+ Events uint32
+ X_padFd int32
+ Fd int32
+ Pad int32
}
const (
diff --git a/src/syscall/ztypes_linux_ppc64le.go b/src/syscall/ztypes_linux_ppc64le.go
index 27ca004834..a1180553ec 100644
--- a/src/syscall/ztypes_linux_ppc64le.go
+++ b/src/syscall/ztypes_linux_ppc64le.go
@@ -574,9 +574,10 @@ type Ustat_t struct {
}
type EpollEvent struct {
- Events uint32
- Fd int32
- Pad int32
+ Events uint32
+ X_padFd int32
+ Fd int32
+ Pad int32
}
const (