From patchwork Tue Jun 6 08:08:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 10338 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3235173vqr; Tue, 6 Jun 2023 01:29:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7BtIj7xcziMQ8WcyxNdXr99ZJu2qQR4vD4cBnF0wzB7P0fcXTNTCCItA2ls3nbXzg80Dh6 X-Received: by 2002:a05:6359:69f:b0:129:c8f7:c1a6 with SMTP id ei31-20020a056359069f00b00129c8f7c1a6mr2106733rwb.2.1686040157794; Tue, 06 Jun 2023 01:29:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686040157; cv=none; d=google.com; s=arc-20160816; b=jFidX8+ObkovsFao9E4nQ50L+bCR+ss3Lp8tfhZND2R1W+SeJM2K9v2GV1SYZII6Si nhFUzkaLRHZWIbB1hw0LMjU4VvfIJkGm6I4AjLGEtcj38PpTmNrASn8YCZDFuZTp1IJv dyD+DKsS1F+po0sanuPFL4YGaYLbfCRqKxwBysHY6PMqWUasoDm8Ex/UWLXllYFuRxII JE/m21YyxZr2MkdFmmynyHLaBmb/AuRfm5l5C59ALpCTH5c+w0Fo5rs1IoSo3LS6JmmG aHey9pFLDRIOUhDwrsTN3LlzfyzCtKL25ak7c/2JN4GNYzU7m57sJTm1FY4sWvv2HB+i 1qng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=k7PKtcsvqnpppR/VeJhJtAiSFrUqHaJBqSH68I/j9aU=; b=nwltV6A3KWWLPnsWCgAKw1pwaDXK41aBIn22o4rera9GrJXg9o77QYo/Z37QYehLMM Bm82BjfvDkhNh6sMntUmPHTniqR+82CnWd+ISByExBFyrnaTjbcHEwHpvnTBjzoJOP5q 7lVvjlyaDPU8LgEfL0ch8QH958fs1bTkm/Lbnk59fTrKcD1WCcBSo5fJ7Tdky5raezny GENroMFid5/Vi5gCqLJy/kxLBYKbMSOF7avS4q61S+Ur/w4Nk5kNMJUawXNtp9eMlYm9 p2y0FFEMC72RYt0i7RkCyd4+2kXPbL5efuPGZ4TwkGxXy1yRrx6Xr/fNNWynlTpYIiex urXw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bv3-20020a632e03000000b0053f7fcd4705si6889269pgb.541.2023.06.06.01.29.05; Tue, 06 Jun 2023 01:29:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235005AbjFFII7 (ORCPT + 99 others); Tue, 6 Jun 2023 04:08:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234658AbjFFII5 (ORCPT ); Tue, 6 Jun 2023 04:08:57 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.65.254]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69D47E8; Tue, 6 Jun 2023 01:08:55 -0700 (PDT) X-QQ-mid: bizesmtp71t1686038924tds2m1zg Received: from linux-lab-host.localdomain ( [61.141.77.49]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 06 Jun 2023 16:08:43 +0800 (CST) X-QQ-SSF: 01200000000000D0V000000A0000000 X-QQ-FEAT: OFQdrTmJ2CS8cMsJdI2SFzlvHmY/Ck0nNyKgKxiLI9UnvdqlnoY+5XpF6N8Br XdmjANCFOn/QtFRLGmvdaM4DpVxz5fMFWbRLx3CMqE+ZG+Lj5ARnkDkCxV8n6MuSHdda1g1 j5wTsf6/AxFnmKq96zAS5vJXIC574TOyhXYGECXT+kBzBtefdfjL2LXn2603hiuVTsIdQ4r 1OpvaBna3Uv95kdvvy4G3cvoj+wX7ouNqj4jNVJBCjXSuCMOO7BmR1R2YAKmIstqR9RSQX8 LrfjIjY3gF2xk1M2RwGPecOM6r07gUJ+j2sZ/axWmNW4+7I6M542KZpf+ZFg7/rZY2W3BzL f5CKv26VV38EwMDkkF7NNRNHP/JS4/RjOPYJ9K9HNKPR4MY7LsCzrV/y+5pYQ== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 9694467751585359085 From: Zhangjin Wu To: thomas@t-8ch.de, w@1wt.eu Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org Subject: [PATCH v2 0/4] tools/nolibc: add two new syscall helpers Date: Tue, 6 Jun 2023 16:08:40 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrsz:qybglogicsvrsz3a-3 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767941244891757974?= X-GMAIL-MSGID: =?utf-8?q?1767941244891757974?= Willy, Thomas This is the revision of the v1 syscall helpers [1], just rebased it on 20230606-nolibc-rv32+stkp7a of [2]. It doesn't conflict with the -ENOSYS patchset [3], so, it is ok to simply merge both of them. This revision mainly applied your suggestions of v1, both of the syscall return and call helpers are simplified or cleaned up. Changes from v1 -> v2: * tools/nolibc: sys.h: add __syscall() and __sysret() helpers * Use inline function instead of macro for the syscall return helper (Suggestion from Thomas) * Rename syscall return helper from __syscall_ret to __sysret (align with __syscall and it is not that long now) * Make __sysret() be always inline (Suggestion from Willy) * Simplify the whole __syscall() macro to oneline code (Benefit from the fixed 'long' return type of syscalls) * tools/nolibc: unistd.h: apply __sysret() helper * Convert the whole _syscall() macro to oneline code * tools/nolibc: sys.h: apply __sysret() helper * Futher convert both brk() and getpagesize() to oneline code * tools/nolibc: sys.h: apply __syscall() helper * Keep the same as v1, because the __syscall() usage not changed Best regards, Zhangjin --- [1]: https://lore.kernel.org/linux-riscv/cover.1685856497.git.falcon@tinylab.org/ [2]: https://git.kernel.org/pub/scm/linux/kernel/git/wtarreau/nolibc.git [3]: https://lore.kernel.org/linux-riscv/cover.1685780412.git.falcon@tinylab.org/ Zhangjin Wu (4): tools/nolibc: sys.h: add __syscall() and __sysret() helpers tools/nolibc: unistd.h: apply __sysret() helper tools/nolibc: sys.h: apply __sysret() helper tools/nolibc: sys.h: apply __syscall() helper tools/include/nolibc/sys.h | 366 ++++++---------------------------- tools/include/nolibc/unistd.h | 11 +- 2 files changed, 57 insertions(+), 320 deletions(-)