From patchwork Wed Nov 18 14:02:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 546015 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B6B6314141D for ; Thu, 19 Nov 2015 01:03:16 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=o63JquQu; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=J6HYdUBFf+0jgbUTvtKuXcmoHF72P9c 1jfaDOr8EMwJr4s0opDH9V562OjeByvlWxVcf7ZKdJbXJHI4IZCNgIwQy1I48lzn BX8g4jwB8yhgmbK4UyyLpBTYDNPFuClSF9y0uxIy1vwd8tCdjd0rA98WGK7ZKeP5 RFDjc/Kaqzow= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=TBSzKMVAgk3nL9YvYQO5ry3fupA=; b=o63Jq uQuL2uf2zWRkdmW47Zc5BPrdRHKzrv7ajPBk9XOQDcnTmB1FQADUyyQUP9+XvraH FujT68mwnXM1J1hPsQ8UC/GNxDx6RJ6sNkQZ8voTBLrdp89XLFNznwIVPL5Yer9p lVvKoeC3PoBuxSHSZrih+G2qOrds41LIQ5xI64= Received: (qmail 27281 invoked by alias); 18 Nov 2015 14:02:54 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 27152 invoked by uid 89); 18 Nov 2015 14:02:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-yk0-f180.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5KnyLKkUgb1qlDjSfSi9n17DPiYja97sx+o9pGxTkQw=; b=QZm7x6hxta22FIq/MyxrmQ5J57V0P+fXBxFcZT7C9i4NW/7clX9epq8bxx3Xf7quWH QqGhoi+3oKuf4w6o04gdFY1EtHRt17bVfm5hBs2yM2c3lKPSHdH6/fC+kV2jSwBdf5D3 6TnfrirzgnrKlnGgd23MXk1u0Egw5Q2Ou4nL1YCVvTg9TFoBn8fi/VFxyoTdyPsLpgRJ +LXReaKkdRklMlQ2wHxTbwc4Fw2sI8vZw2m5h8ca/xoXvXLP1fE0nUZx33TmsRurgSpN 4TO7FIl5gPUigJkli1EQL/Lh57rJ9HceNGE7rMna3y0W02DXMi1J73S6CGHQdLHr0mo8 WMwA== X-Gm-Message-State: ALoCoQkMiPrRYQeR0rG9cgeVzX4YM4QGinxbPiY5r6J4Zwrw/YlcbnLHL3UQ/2vKtzJuGCX91TrZ X-Received: by 10.13.230.131 with SMTP id p125mr1781699ywe.328.1447855367744; Wed, 18 Nov 2015 06:02:47 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Adhemerval Zanella Subject: [PATCH 2/4] Consolidate off_t/off64_t syscall argument passing Date: Wed, 18 Nov 2015 12:02:34 -0200 Message-Id: <1447855356-4140-3-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1447855356-4140-1-git-send-email-adhemerval.zanella@linaro.org> References: <1447855356-4140-1-git-send-email-adhemerval.zanella@linaro.org> From: Adhemerval Zanella This patch add two new macros to use along with off_t and off64_t argument syscalls. The rationale for this change is: 1. Remove multiple implementations for the same syscall for different architectures (for instance, pread have 6 different implementations). 2. Also remove the requirement to use syscall wrappers for cancellable entrypoints. The macro usage should be used along __ALIGNMENT_ARG to follow ABI constrains for architecture where it applies. For instance, pread can be rewritten as: return SYSCALL_CANCEL (pread, fd, buf, count, __ALIGNMENT_ARG SYSCALL_LL (offset)); Another macro, SYSCALL_LL64, is provided for off64_t. The changes itself are not currently used in any implementation, so no code change is expected. * sysdeps/unix/sysv/linux/aarch64/sysdep.h (SYSCALL_LL): New macro. (SYSCALL_LL64): Likewise. * sysdeps/unix/sysv/linux/alpha/sysdep.h (SYSCALL_LL): Likewise. (SYSCALL_LL64): Likewise. * sysdeps/unix/sysv/linux/arm/sysdep.h (SYSCALL_LL): New macro. (SYSCALL_LL64): Likewise. * sysdeps/unix/sysv/linux/generic/sysdep.h (__NR__llseek): Define only if it is not already defined. * sysdeps/unix/sysv/linux/hppa/sysdep.h (SYSCALL_LL): New macro. (SYSCALL_LL64): Likewise. * sysdeps/unix/sysv/linux/i386/sysdep.h (SYSCALL_LL): Likewise. (SYSCALL_LL64): Likewise. * sysdeps/unix/sysv/linux/ia64/sysdep.h (SYSCALL_LL): Likewise. (SYSCALL_LL64): Likewise. * sysdeps/unix/sysv/linux/m68k/sysdep.h (SYSCALL_LL): Likewise. (SYSCALL_LL64): Likewise. * sysdeps/unix/sysv/linux/microblaze/sysdep.h (SYSCALL_LL): Likewise. (SYSCALL_LL64): Likewise. * sysdeps/unix/sysv/linux/mips/mips32/sysdep.h (SYSCALL_LL): New Macro. (SYSCALL_LL64): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h (SYSCALL_LL): New macro. (SYSCALL_LL64): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h (SYSCALL_LL): Likewise. (SYSCALL_LL64): Likewise. * sysdeps/unix/sysv/linux/nios2/sysdep.h (SYSCALL_LL): Likewise. (SYSCALL_LL64): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h (SYSCALL_LL): New macro. (SYSCALL_LL64): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h (SYSCALL_LL): Likewise. (SYSCALL_LL64): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h (SYSCALL_LL): Likewise. (SYSCALL_LL64): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h (SYSCALL_LL): Likewise. (SYSCALL_LL64): Likewise. * sysdeps/unix/sysv/linux/sh/sysdep.h (SYSCALL_LL): Likewise. (SYSCALL_LL64): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h (SYSCALL_LL): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h (SYSCALL_LL64): Likewise. * sysdeps/unix/sysv/linux/sparc/sysdep.h: Include generic sysdep.h. * sysdeps/unix/sysv/linux/tile/sysdep.h (SYSCALL_LL): New macro. (SYSCALL_LL64): Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep.h (SYSCALL_LL): Likewise. (SYSCALL_LL64): Likewise. --- sysdeps/unix/sysv/linux/aarch64/sysdep.h | 3 ++ sysdeps/unix/sysv/linux/alpha/sysdep.h | 5 ++ sysdeps/unix/sysv/linux/arm/sysdep.h | 7 +++ sysdeps/unix/sysv/linux/generic/sysdep.h | 2 + sysdeps/unix/sysv/linux/hppa/sysdep.h | 7 +++ sysdeps/unix/sysv/linux/i386/sysdep.h | 7 +++ sysdeps/unix/sysv/linux/ia64/sysdep.h | 5 ++ sysdeps/unix/sysv/linux/m68k/sysdep.h | 7 +++ sysdeps/unix/sysv/linux/microblaze/sysdep.h | 7 +++ sysdeps/unix/sysv/linux/mips/mips32/sysdep.h | 7 +++ sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h | 5 ++ sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h | 5 ++ sysdeps/unix/sysv/linux/nios2/sysdep.h | 6 +++ sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h | 7 +++ sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h | 5 ++ sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h | 7 +++ sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h | 5 ++ sysdeps/unix/sysv/linux/sh/sysdep.h | 7 +++ sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h | 6 +++ sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h | 4 ++ sysdeps/unix/sysv/linux/sparc/sysdep.h | 1 + sysdeps/unix/sysv/linux/tile/sysdep.h | 6 +++ sysdeps/unix/sysv/linux/x86_64/sysdep.h | 6 +++ 24 files changed, 189 insertions(+) diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h index fe94a50..2e14b09 100644 --- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h +++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h @@ -151,6 +151,9 @@ #else /* not __ASSEMBLER__ */ +/* No adjustment required to pass long long on syscalls. */ +# define SYSCALL_LL(__val) (__val) +# define SYSCALL_LL64(__val) (__val) /* List of system calls which are supported as vsyscalls. */ # define HAVE_CLOCK_GETRES_VSYSCALL 1 diff --git a/sysdeps/unix/sysv/linux/alpha/sysdep.h b/sysdeps/unix/sysv/linux/alpha/sysdep.h index aea77b4..d77e8e3 100644 --- a/sysdeps/unix/sysv/linux/alpha/sysdep.h +++ b/sysdeps/unix/sysv/linux/alpha/sysdep.h @@ -27,9 +27,14 @@ /* There is some commonality. */ #include #include +#include #include +/* No adjustment required to pass long long on syscalls. */ +#define SYSCALL_LL(__val) (__val) +#define SYSCALL_LL64(__val) (__val) + /* For Linux we can use the system call table in the header file /usr/include/asm/unistd.h of the kernel. But these symbols do not follow the SYS_* syntax diff --git a/sysdeps/unix/sysv/linux/arm/sysdep.h b/sysdeps/unix/sysv/linux/arm/sysdep.h index c8715f7..ec237dc 100644 --- a/sysdeps/unix/sysv/linux/arm/sysdep.h +++ b/sysdeps/unix/sysv/linux/arm/sysdep.h @@ -23,6 +23,7 @@ /* There is some commonality. */ #include #include +#include /* Defines RTLD_PRIVATE_ERRNO and USE_DL_SYSINFO. */ #include @@ -317,6 +318,12 @@ __local_syscall_error: \ #else /* not __ASSEMBLER__ */ +/* Macro to adjust 'long long' argument for syscalls. */ +#define SYSCALL_LL(__val) \ + __LONG_LONG_PAIR (__val >> 31, __val) +#define SYSCALL_LL64(__val) \ + __LONG_LONG_PAIR ((long) (__val >> 32), (long) (__val & 0xffffffff)) + /* Define a macro which expands into the inline wrapper code for a system call. */ #undef INLINE_SYSCALL diff --git a/sysdeps/unix/sysv/linux/generic/sysdep.h b/sysdeps/unix/sysv/linux/generic/sysdep.h index 70e7158..e00f92d 100644 --- a/sysdeps/unix/sysv/linux/generic/sysdep.h +++ b/sysdeps/unix/sysv/linux/generic/sysdep.h @@ -22,7 +22,9 @@ #include /* Provide the common name to allow more code reuse. */ +#ifndef __NR__llseek #define __NR__llseek __NR_llseek +#endif #if __WORDSIZE == 64 /* By defining the older names, glibc will build syscall wrappers for diff --git a/sysdeps/unix/sysv/linux/hppa/sysdep.h b/sysdeps/unix/sysv/linux/hppa/sysdep.h index 2cae70f..c5fcace 100644 --- a/sysdeps/unix/sysv/linux/hppa/sysdep.h +++ b/sysdeps/unix/sysv/linux/hppa/sysdep.h @@ -24,6 +24,7 @@ #include #include #include +#include /* Defines RTLD_PRIVATE_ERRNO. */ #include @@ -351,6 +352,12 @@ L(pre_end): ASM_LINE_SEP \ #else +/* Macro to adjust 'long long' argument for syscalls. */ +#define SYSCALL_LL(__val) \ + __LONG_LONG_PAIR (__val >> 31, __val) +#define SYSCALL_LL64(__val) \ + __LONG_LONG_PAIR ((long) (__val >> 32), (long) (__val & 0xffffffff)) + /* GCC has to be warned that a syscall may clobber all the ABI registers listed as "caller-saves", see page 8, Table 2 in section 2.2.6 of the PA-RISC RUN-TIME architecture diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h index dbe5654..58a72c8 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.h +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -22,6 +22,7 @@ /* There is some commonality. */ #include #include +#include /* Defines RTLD_PRIVATE_ERRNO and USE_DL_SYSINFO. */ #include #include @@ -233,6 +234,12 @@ #else /* !__ASSEMBLER__ */ +/* Macro to adjust 'long long' argument for syscalls. */ +#define SYSCALL_LL(__val) \ + __LONG_LONG_PAIR (__val >> 31, __val) +#define SYSCALL_LL64(__val) \ + __LONG_LONG_PAIR ((long) (__val >> 32), (long) (__val & 0xffffffff)) + extern int __syscall_error (int) attribute_hidden __attribute__ ((__regparm__ (1))); diff --git a/sysdeps/unix/sysv/linux/ia64/sysdep.h b/sysdeps/unix/sysv/linux/ia64/sysdep.h index eafcc7a..1b34109 100644 --- a/sysdeps/unix/sysv/linux/ia64/sysdep.h +++ b/sysdeps/unix/sysv/linux/ia64/sysdep.h @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -186,6 +187,10 @@ #else /* not __ASSEMBLER__ */ +/* No adjustment required to pass long long on syscalls. */ +#define SYSCALL_LL(__val) (__val) +#define SYSCALL_LL64(__val) (__val) + #define BREAK_INSN_1(num) "break " #num ";;\n\t" #define BREAK_INSN(num) BREAK_INSN_1(num) diff --git a/sysdeps/unix/sysv/linux/m68k/sysdep.h b/sysdeps/unix/sysv/linux/m68k/sysdep.h index e55446c..be3183c 100644 --- a/sysdeps/unix/sysv/linux/m68k/sysdep.h +++ b/sysdeps/unix/sysv/linux/m68k/sysdep.h @@ -18,6 +18,7 @@ . */ #include +#include #include /* Defines RTLD_PRIVATE_ERRNO. */ @@ -221,6 +222,12 @@ SYSCALL_ERROR_LABEL: \ #else /* not __ASSEMBLER__ */ +/* Macro to adjust 'long long' argument for syscalls. */ +#define SYSCALL_LL(__val) \ + __LONG_LONG_PAIR (__val >> 31, __val) +#define SYSCALL_LL64(__val) \ + __LONG_LONG_PAIR ((long) (__val >> 32), (long) (__val & 0xffffffff)) + /* Define a macro which expands into the inline wrapper code for a system call. */ #undef INLINE_SYSCALL diff --git a/sysdeps/unix/sysv/linux/microblaze/sysdep.h b/sysdeps/unix/sysv/linux/microblaze/sysdep.h index 75dd11f..675c3ea 100644 --- a/sysdeps/unix/sysv/linux/microblaze/sysdep.h +++ b/sysdeps/unix/sysv/linux/microblaze/sysdep.h @@ -22,6 +22,7 @@ #include #include #include +#include /* Defines RTLD_PRIVATE_ERRNO. */ #include @@ -163,6 +164,12 @@ SYSCALL_ERROR_LABEL_DCL: \ #else /* not __ASSEMBLER__ */ +/* Macro to adjust 'long long' argument for syscalls. */ +#define SYSCALL_LL(__val) \ + __LONG_LONG_PAIR (__val >> 31, __val) +#define SYSCALL_LL64(__val) \ + __LONG_LONG_PAIR ((long) (__val >> 32), (long) (__val & 0xffffffff)) + /* Define a macro which expands into the inline wrapper code for a system call. */ # undef INLINE_SYSCALL diff --git a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h index cb8f4a8..8dbec9c 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h @@ -21,6 +21,7 @@ /* There is some commonality. */ #include #include +#include #include @@ -46,6 +47,12 @@ #else /* ! __ASSEMBLER__ */ +/* Macro to adjust 'long long' argument for syscalls. */ +#define SYSCALL_LL(__val) \ + __LONG_LONG_PAIR (__val >> 31, offset) +#define SYSCALL_LL64(__val) \ + __LONG_LONG_PAIR ((long) (__val >> 32), (long) (__val & 0xffffffff)) + /* Define a macro which expands into the inline wrapper code for a system call. */ #undef INLINE_SYSCALL diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h index b97bf0b..e6b2b66 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h @@ -21,6 +21,7 @@ /* There is some commonality. */ #include #include +#include #include @@ -44,6 +45,10 @@ #else /* ! __ASSEMBLER__ */ +/* No adjustment required to pass long long on syscalls. */ +#define SYSCALL_LL(__val) (__val) +#define SYSCALL_LL64(__val) (__val) + /* Convert X to a long long, without losing any bits if it is one already or warning if it is a 32-bit pointer. */ #define ARGIFY(X) ((long long) (__typeof__ ((X) - (X))) (X)) diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h index 6bbeeb0..f6732f0 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h @@ -21,6 +21,7 @@ /* There is some commonality. */ #include #include +#include #include @@ -44,6 +45,10 @@ #else /* ! __ASSEMBLER__ */ +/* No adjustment required to pass long long on syscalls. */ +#define SYSCALL_LL(__val) (__val) +#define SYSCALL_LL64(__val) (__val) + /* Define a macro which expands into the inline wrapper code for a system call. */ #undef INLINE_SYSCALL diff --git a/sysdeps/unix/sysv/linux/nios2/sysdep.h b/sysdeps/unix/sysv/linux/nios2/sysdep.h index 66a77f4..e047210 100644 --- a/sysdeps/unix/sysv/linux/nios2/sysdep.h +++ b/sysdeps/unix/sysv/linux/nios2/sysdep.h @@ -137,6 +137,12 @@ #else /* __ASSEMBLER__ */ +/* Macro to adjust 'long long' argument for syscalls. */ +#define SYSCALL_LL(__val) \ + __LONG_LONG_PAIR (__val >> 31, __val) +#define SYSCALL_LL64(__val) \ + __LONG_LONG_PAIR ((long) (__val >> 32), (long) (__val & 0xffffffff)) + /* In order to get __set_errno() definition in INLINE_SYSCALL. */ #include diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h index 7f389e4..c25f824 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h @@ -20,6 +20,7 @@ #include #include +#include #include /* Some systen calls got renamed over time, but retained the same semantics. @@ -51,6 +52,12 @@ # include +/* Macro to adjust 'long long' argument for syscalls. */ +# define SYSCALL_LL(__val) \ + __LONG_LONG_PAIR (offset >> 31, offset) +# define SYSCALL_LL64(__val) \ + __LONG_LONG_PAIR ((long) (__val >> 32), (long) __val) + /* Define a macro which expands inline into the wrapper code for a VDSO call. This use is for internal calls that do not need to handle errors normally. It will never touch errno. diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h index 6803cce..c4bee54 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h @@ -22,6 +22,7 @@ #include #include +#include #include /* Define __set_errno() for INLINE_SYSCALL macro below. */ @@ -62,6 +63,10 @@ #endif /* __ASSEMBLER__ */ +/* No adjustment required to pass long long on syscalls. */ +#define SYSCALL_LL(__val) (__val) +#define SYSCALL_LL64(__val) (__val) + /* This version is for internal uses when there is no desire to set errno */ #define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, type, nr, args...) \ diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h index d29b685..3e03c5c 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h @@ -22,6 +22,7 @@ #include #include #include +#include #include /* For RTLD_PRIVATE_ERRNO. */ #include @@ -179,6 +180,12 @@ #endif /* __ASSEMBLER__ */ +/* Macro to adjust 'long long' argument for syscalls. */ +#define SYSCALL_LL(__val) \ + __LONG_LONG_PAIR (__val >> 31, __val) +#define SYSCALL_LL64(__val) \ + __LONG_LONG_PAIR ((long) (__val >> 32), (long) (__val & 0xffffffff)) + #undef INLINE_SYSCALL #define INLINE_SYSCALL(name, nr, args...) \ ({ \ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h index a373207..c7b3ad4 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h @@ -23,6 +23,7 @@ #include #include #include +#include #include /* For RTLD_PRIVATE_ERRNO. */ #include @@ -185,6 +186,10 @@ #endif /* __ASSEMBLER__ */ +/* No adjustment required to pass long long on syscalls. */ +#define SYSCALL_LL(__val) (__val) +#define SYSCALL_LL64(__val) (__val) + #undef INLINE_SYSCALL #define INLINE_SYSCALL(name, nr, args...) \ ({ \ diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.h b/sysdeps/unix/sysv/linux/sh/sysdep.h index ab5b2c3..5a6c6a2 100644 --- a/sysdeps/unix/sysv/linux/sh/sysdep.h +++ b/sysdeps/unix/sysv/linux/sh/sysdep.h @@ -23,6 +23,7 @@ /* There is some commonality. */ #include #include +#include #include /* For Linux we can use the system call table in the header file @@ -191,6 +192,12 @@ #else /* not __ASSEMBLER__ */ +/* Macro to adjust 'long long' argument for syscalls. */ +#define SYSCALL_LL(__val) \ + __LONG_LONG_PAIR (__val >> 31, __val) +#define SYSCALL_LL64(__val) \ + __LONG_LONG_PAIR ((long) (__val >> 32), (long) (__val & 0xffffffff)) + #define SYSCALL_INST_STR0 "trapa #0x10\n\t" #define SYSCALL_INST_STR1 "trapa #0x11\n\t" #define SYSCALL_INST_STR2 "trapa #0x12\n\t" diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h index e37e534..50d68cb 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h @@ -107,6 +107,12 @@ ENTRY(name); \ #else /* __ASSEMBLER__ */ +/* Macro to adjust 'long long' argument for syscalls. */ +#define SYSCALL_LL(__val) \ + __LONG_LONG_PAIR (__val >> 31, __val) +#define SYSCALL_LL64(__val) \ + __LONG_LONG_PAIR ((long) (__val >> 32), (long) (__val & 0xffffffff)) + #define __SYSCALL_STRING \ "ta 0x10;" \ "bcc 1f;" \ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h index 5b76f15..ef08ad3 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h @@ -116,6 +116,10 @@ ENTRY(name); \ #else /* __ASSEMBLER__ */ +/* No adjustment required to pass long long on syscalls. */ +#define SYSCALL_LL(__val) (__val) +#define SYSCALL_LL64(__val) (__val) + #define __SYSCALL_STRING \ "ta 0x6d;" \ "bcc,pt %%xcc, 1f;" \ diff --git a/sysdeps/unix/sysv/linux/sparc/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sysdep.h index c9843de..0d20b5d 100644 --- a/sysdeps/unix/sysv/linux/sparc/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sysdep.h @@ -22,6 +22,7 @@ #include #include #include +#include #ifdef __ASSEMBLER__ diff --git a/sysdeps/unix/sysv/linux/tile/sysdep.h b/sysdeps/unix/sysv/linux/tile/sysdep.h index d1268de..1a36d32 100644 --- a/sysdeps/unix/sysv/linux/tile/sysdep.h +++ b/sysdeps/unix/sysv/linux/tile/sysdep.h @@ -78,6 +78,12 @@ #include +/* Macro to adjust 'long long' argument for syscalls. */ +#define SYSCALL_LL(__val) \ + __LONG_LONG_PAIR (__val >> 31, __val) +#define SYSCALL_LL64(__val) \ + __LONG_LONG_PAIR ((long) (__val >> 32), (long) (__val & 0xffffffff)) + /* Define a macro which expands inline into the wrapper code for a system call. */ # undef INLINE_SYSCALL diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h index fc132f6..f85f8f9 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h @@ -21,6 +21,7 @@ /* There is some commonality. */ #include #include +#include #include #if IS_IN (rtld) @@ -188,6 +189,11 @@ # define DOARGS_6 DOARGS_5 #else /* !__ASSEMBLER__ */ + +/* No adjustment required to pass long long on syscalls. */ +# define SYSCALL_LL(__val) (__val) +# define SYSCALL_LL64(__val) (__val) + /* Define a macro which expands inline into the wrapper code for a system call. */ # undef INLINE_SYSCALL