From patchwork Wed Nov 18 19:55:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 41124 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 270A13948D95; Wed, 18 Nov 2020 19:56:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 270A13948D95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1605729399; bh=ZenPwEi115pTT4YX6gM51fP5WH/NztANyBT47K3bygc=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=TTMD/5YytOdyYLhxM+Pew+YIOrEY9vBog+BvOg0FFhkbC0/t+Sk1BgPktTX0N2IIa CJ5jZjgFVcjgZMNrsPWT7ULWk1gPQKy3qceSLCy95ertwYB3LoGjIPhf0sxVxMdOFf RlfseFp3vFKCOB38cZgfurt3n22I9sKznOfPt4A8= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) by sourceware.org (Postfix) with ESMTPS id 8F6B33947C0D for ; Wed, 18 Nov 2020 19:56:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8F6B33947C0D Received: by mail-qk1-x736.google.com with SMTP id 199so3051200qkg.9 for ; Wed, 18 Nov 2020 11:56:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZenPwEi115pTT4YX6gM51fP5WH/NztANyBT47K3bygc=; b=B8JWfnPjn8FSX3K0gZHtf2+ALdeXTaDmhkqvgLBB3z+fxThwwWH93yT/Bj/QoLRKAR 1+Cy3OPRbp7uBVe2IEuLoS/ueann0sHuuZSW1CutLM4i0ZPddCL8SokLp2BLFxErnXam mhKq3gx1g4LS0FXoqcAtoGQV+ZdBFaVZFmPj7hK+THXYrQKZYPhy60AFgtiOPgKmLIer MRXbAXwhk0witnNhXMQ6rm7ENxb8IWQZtCCUtBrmUo9HVRqk/Lj2vNkSoi7t8axul9+R IMxgygomH8VcqhbjxNkPYQ1HcFIrBfuDUBVLAd4i8Cuz6WNEh/6p4SwGjn7oIYba4PTv otPQ== X-Gm-Message-State: AOAM531wgORG00XwzfyrTqeKCIiJQ6O2zm1xNrLOe2RGklBw0Pn2+GXo T1yjJvE6hJ+VMnHLHmQwxo+K7sPZci41zw== X-Google-Smtp-Source: ABdhPJztxM8UbKjybi4nJn43+9hiR2WtgWfhqV0+9WB+AbW/FEzy06fR+c2as8xThQwciiJ10vZ74g== X-Received: by 2002:ae9:dc81:: with SMTP id q123mr6805513qkf.426.1605729391627; Wed, 18 Nov 2020 11:56:31 -0800 (PST) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id f27sm6538775qtv.95.2020.11.18.11.56.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2020 11:56:31 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH 24/28] x32: Implement lseek64 in C Date: Wed, 18 Nov 2020 16:55:48 -0300 Message-Id: <20201118195552.2687336-25-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201118195552.2687336-1-adhemerval.zanella@linaro.org> References: <20201118195552.2687336-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Checked on x86_64-linux-gnu-x32 --- sysdeps/unix/sysv/linux/x86_64/x32/lseek.S | 43 ------------------- sysdeps/unix/sysv/linux/x86_64/x32/lseek64.S | 1 - sysdeps/unix/sysv/linux/x86_64/x32/lseek64.c | 44 ++++++++++++++++++++ 3 files changed, 44 insertions(+), 44 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/x86_64/x32/lseek.S delete mode 100644 sysdeps/unix/sysv/linux/x86_64/x32/lseek64.S create mode 100644 sysdeps/unix/sysv/linux/x86_64/x32/lseek64.c diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/lseek.S b/sysdeps/unix/sysv/linux/x86_64/x32/lseek.S deleted file mode 100644 index ca656ba12a..0000000000 --- a/sysdeps/unix/sysv/linux/x86_64/x32/lseek.S +++ /dev/null @@ -1,43 +0,0 @@ -/* The lseek system call with 64-bit offset. Linux/x32 version. - Copyright (C) 2012-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include - -/* Return -1LL in a full 64 bits. */ -#undef SYSCALL_ERROR_HANDLER -#define SYSCALL_ERROR_HANDLER \ -0: \ - SYSCALL_SET_ERRNO; \ - orq $-1, %rax; \ - ret; - -/* Always use our own error handler. */ -#undef SYSCALL_ERROR_LABEL -#define SYSCALL_ERROR_LABEL 0f - -PSEUDO (__libc_lseek64, lseek, 3) - ret -PSEUDO_END (__libc_lseek64) - -weak_alias (__libc_lseek64, __lseek64) -libc_hidden_weak (__lseek64) -weak_alias (__libc_lseek64, lseek64) -libc_hidden_weak (lseek64) -weak_alias (__libc_lseek64, __lseek) -libc_hidden_weak (__lseek) -weak_alias (__libc_lseek64, lseek) diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/lseek64.S b/sysdeps/unix/sysv/linux/x86_64/x32/lseek64.S deleted file mode 100644 index d81e98fb51..0000000000 --- a/sysdeps/unix/sysv/linux/x86_64/x32/lseek64.S +++ /dev/null @@ -1 +0,0 @@ -/* We don't need a definition since the llseek function is what we need. */ diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/lseek64.c b/sysdeps/unix/sysv/linux/x86_64/x32/lseek64.c new file mode 100644 index 0000000000..49c959943b --- /dev/null +++ b/sysdeps/unix/sysv/linux/x86_64/x32/lseek64.c @@ -0,0 +1,44 @@ +/* Linux lseek implementation, 64 bits off_t. x86_64/x32 version. + Copyright (C) 2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#include +#include +#include + +static inline off64_t +__lseek64_syscall (long int name, int fd, off64_t offset, int whence) +{ + off64_t resultvar; + asm volatile ("syscall\n\t" + : "=a" (resultvar) + : "0" (name), "D" (fd), "S" (offset), "d" (whence) + : "memory", "cc", "r11", "cx"); + return resultvar < 0 + ? SYSCALL_ERROR_LABEL (INTERNAL_SYSCALL_ERRNO (resultvar)) + : resultvar; +} + +#undef INLINE_SYSCALL_CALL +#define INLINE_SYSCALL_CALL(name, ...) \ + __lseek64_syscall(__NR_##name, __VA_ARGS__) + +/* Disable the llseek compat symbol. */ +#undef SHLIB_COMPAT +#define SHLIB_COMPAT(a, b, c) 0 + +#include