From d70cb46f0fde56ec0147c5cc679714fd63cb10bb Mon Sep 17 00:00:00 2001 From: Alex Brainman Date: Wed, 6 Apr 2016 16:11:22 +1000 Subject: runtime: use windows.NewLazySystemDLL in mksyscall_windows.go Change-Id: Ie4c4ff4167ee45ae93a8b764fb6197f402e7994d Reviewed-on: https://go-review.googlesource.com/21593 Reviewed-by: Brad Fitzpatrick --- src/syscall/mksyscall_windows.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/syscall') 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 + ")" -- cgit v1.3 From 6c5352f181846b73d532c039df3017befe657d6a Mon Sep 17 00:00:00 2001 From: Michael Munday Date: Fri, 8 Apr 2016 11:40:51 -0400 Subject: syscall: add assembly for Linux on s390x Change-Id: I42ade65a91f3effc03dd663ee449410baa9f8ca8 Reviewed-on: https://go-review.googlesource.com/21740 Reviewed-by: Bill O'Farrell Reviewed-by: Minux Ma Run-TryBot: Minux Ma TryBot-Result: Gobot Gobot --- src/syscall/asm_linux_s390x.s | 156 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 src/syscall/asm_linux_s390x.s (limited to 'src/syscall') 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 -- cgit v1.3 From 44f80f6d4925ae59b519ced3a626170099258904 Mon Sep 17 00:00:00 2001 From: Lynn Boger Date: Wed, 6 Apr 2016 11:07:12 -0500 Subject: syscall: fix epoll_event struct for ppc64le/ppc64 The existing epoll_event structure used by many of the epoll_* syscalls was defined incorrectly for use with ppc64le & ppc64 in the syscall directory. This resulted in the caller getting incorrect information on return from these syscalls. This caused failures in fsnotify as well as builds with upstream Docker. The structure is defined correctly in gccgo. This adds a pad field that is expected for these syscalls on ppc64le, ppc64. Fixes #15135 Change-Id: If7e8ea9eb1d1ca5182c8dc0f935b334127341ffd Reviewed-on: https://go-review.googlesource.com/21582 Reviewed-by: Ian Lance Taylor Run-TryBot: Ian Lance Taylor --- src/syscall/types_linux.go | 3 +++ src/syscall/ztypes_linux_ppc64.go | 7 ++++--- src/syscall/ztypes_linux_ppc64le.go | 7 ++++--- 3 files changed, 11 insertions(+), 6 deletions(-) (limited to 'src/syscall') 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 @@ -116,6 +116,9 @@ struct my_epoll_event { // padding is not specified in linux/eventpoll.h but added to conform to the // 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 ( -- cgit v1.3 From 4edb40d441b0def61507e65141535de4d86b9edc Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Wed, 27 Apr 2016 11:08:58 -0700 Subject: syscall: fix uint64->int cast of control message header Change-Id: I28980b307d10730b122a4f833809bc400d6aff24 Reviewed-on: https://go-review.googlesource.com/22525 Reviewed-by: Brad Fitzpatrick Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- src/syscall/sockcmsg_unix.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/syscall') 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 -- cgit v1.3