From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7FD6CC0218A for ; Thu, 30 Jan 2025 11:22:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pqxmhalOR9kvOlWhx6PAJq4wHbOQEtsAJfU/yyKmgo4=; b=5B62i+tB0ZbHtZ hM5JJaxcVGWdTDLQX/N/e4bGshEVf1moGPoM7ST4rIWw+rfsGAMLJ+qHMfEYGKmVTKiYLjicbYWI7 5KQtgHYKwD9nGmcINTmZksuUKLjQJnj0SW/xqVLwqXV910AQQa3C4v4Fl85xrJF88a1gbKwr7E4Nq g4XdiaO8RvFuUefSIwfpLCSNuFejplXDxAhbriEHAqQMZBP9/NbvbSfJzEOrqmg0KErXAVACTpOUO bz46yhoazBcZhzjTsFXQtVARdVNffmHVKbDxEI0mFGyaJKfwsgv+tiG9jbjjjKYHQj4z7kdY9Bsl1 j6W+u8NZ/znlTNPwd+AQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tdScg-00000008hRj-34fi; Thu, 30 Jan 2025 11:22:14 +0000 Received: from vmicros1.altlinux.org ([194.107.17.57]) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tdScd-00000008hQv-3GRo; Thu, 30 Jan 2025 11:22:13 +0000 Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14]) by vmicros1.altlinux.org (Postfix) with ESMTP id 2914072C97D; Thu, 30 Jan 2025 14:22:08 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id F28277CCB3A; Thu, 30 Jan 2025 13:22:07 +0200 (IST) Date: Thu, 30 Jan 2025 13:22:07 +0200 From: "Dmitry V. Levin" To: Sven Schnelle Cc: linux-snps-arc@lists.infradead.org, Rich Felker , Thomas Gleixner , Andreas Larsson , John Paul Adrian Glaubitz , x86@kernel.org, Arnd Bergmann , linux-kernel@vger.kernel.org, "James E.J. Bottomley" , Guo Ren , linux-csky@vger.kernel.org, "H. Peter Anvin" , sparclinux@vger.kernel.org, linux-hexagon@vger.kernel.org, WANG Xuerui , Will Deacon , Eugene Syromyatnikov , Anton Ivanov , Jonas Bonn , linux-s390@vger.kernel.org, Alexander Gordeev , Madhavan Srinivasan , Vasily Gorbik , Yoshinori Sato , linux-sh@vger.kernel.org, Michael Ellerman , Helge Deller , Huacai Chen , Russell King , Christophe Leroy , Dave Hansen , Ingo Molnar , Vineet Gupta , Christian Borntraeger , strace-devel@lists.strace.io, linux-arch@vger.kernel.org, Albert Ou , Mike Frysinger , Davide Berardi , Renzo Davoli , linux-um@lists.infradead.org, Heiko Carstens , Charlie Jenkins , Naveen N Rao , Nicholas Piggin , Stefan Kristiansson , Borislav Petkov , loongarch@lists.linux.dev, Paul Walmsley , Stafford Horne , linux-arm-kernel@lists.infradead.org, Brian Cain , Thomas Bogendoerfer , linux-parisc@vger.kernel.org, linux-openrisc@vger.kernel.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Oleg Nesterov , Dinh Nguyen , linux-riscv@lists.infradead.org, Palmer Dabbelt , Richard Weinberger , Johannes Berg , Alexey Gladkov , "David S. Miller" Subject: Re: [PATCH v3 2/6] syscall.h: add syscall_set_arguments() and syscall_set_return_value() Message-ID: <20250130112207.GA6617@strace.io> References: <20250128091626.GB8601@strace.io> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250130_032212_154713_81903EFB X-CRM114-Status: GOOD ( 25.45 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Thu, Jan 30, 2025 at 09:33:03AM +0100, Sven Schnelle wrote: > "Dmitry V. Levin" writes: > > > These functions are going to be needed on all HAVE_ARCH_TRACEHOOK > > architectures to implement PTRACE_SET_SYSCALL_INFO API. > > > > This partially reverts commit 7962c2eddbfe ("arch: remove unused > > function syscall_set_arguments()") by reusing some of old > > syscall_set_arguments() implementations. > > > > Signed-off-by: Dmitry V. Levin > > Tested-by: Charlie Jenkins > > Reviewed-by: Charlie Jenkins > > --- > > arch/arc/include/asm/syscall.h | 14 +++++++++++ > > arch/arm/include/asm/syscall.h | 13 ++++++++++ > > arch/arm64/include/asm/syscall.h | 13 ++++++++++ > > arch/csky/include/asm/syscall.h | 13 ++++++++++ > > arch/hexagon/include/asm/syscall.h | 14 +++++++++++ > > arch/loongarch/include/asm/syscall.h | 8 ++++++ > > arch/mips/include/asm/syscall.h | 32 ++++++++++++++++++++++++ > > arch/nios2/include/asm/syscall.h | 11 ++++++++ > > arch/openrisc/include/asm/syscall.h | 7 ++++++ > > arch/parisc/include/asm/syscall.h | 12 +++++++++ > > arch/powerpc/include/asm/syscall.h | 10 ++++++++ > > arch/riscv/include/asm/syscall.h | 9 +++++++ > > arch/s390/include/asm/syscall.h | 12 +++++++++ > > arch/sh/include/asm/syscall_32.h | 12 +++++++++ > > arch/sparc/include/asm/syscall.h | 10 ++++++++ > > arch/um/include/asm/syscall-generic.h | 14 +++++++++++ > > arch/x86/include/asm/syscall.h | 36 +++++++++++++++++++++++++++ > > arch/xtensa/include/asm/syscall.h | 11 ++++++++ > > include/asm-generic/syscall.h | 16 ++++++++++++ > > 19 files changed, 267 insertions(+) > > > > diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h > > index 27e3d804b311..b3dd883699e7 100644 > > --- a/arch/s390/include/asm/syscall.h > > +++ b/arch/s390/include/asm/syscall.h > > @@ -78,6 +78,18 @@ static inline void syscall_get_arguments(struct task_struct *task, > > args[0] = regs->orig_gpr2 & mask; > > } > > > > +static inline void syscall_set_arguments(struct task_struct *task, > > + struct pt_regs *regs, > > + const unsigned long *args) > > +{ > > + unsigned int n = 6; > > + > > + while (n-- > 0) > > + if (n > 0) > > + regs->gprs[2 + n] = args[n]; > > + regs->orig_gpr2 = args[0]; > > +} > > Could that be changed to something like: > > for (int n = 1; n < 6; n++) > regs->gprs[2 + n] = args[n]; > regs->orig_gpr2 = args[0]; > > I think this is way easier to parse. I don't mind changing syscall_set_arguments() this way, but it just mirrors syscall_get_arguments(), so I think it would be better if these two functions were written in the same style. Would you like to change syscall_get_arguments() as well? -- ldv _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv