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: 13268688 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 8EC29C77B73 for ; Tue, 6 Jun 2023 08:09:21 +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:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=4r5sB+IE2cMKmXFM5DnPw2296n+92OewByF0CI7FDHc=; b=bvIOvpdXhH7zqF BSIY2x23FRVDDlBpHlNLxxP/XJoKf2Yyq1I8IXOLmw5ptoLUR9wy/5YM+UOryknVD3h2d+/wUVo8F t539C1W+W3fVts+QB8wo+etbuFQR1whainZR0t7Xo8L3TxCBJt1H28KIdYxaNvxUllFFOdittz30e kGXqq5Oli5roYqx4Fe+Ckq7rrfA3vdGfZbE208tr4rBZA27FFbH2mH6Sy8IoUKbVOMEWtm/RkkTz3 DAEnhMOcG/VkK2Hka7Yzahp+MDZubUET5d7ytsmGXp3qjdXqJID1q/6eFnHG/rGmCG80saiOdN0aD Gq+xbRFBiXzhfCXWGbxA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q6Rkg-000jn8-1w; Tue, 06 Jun 2023 08:09:14 +0000 Received: from bg4.exmail.qq.com ([43.154.221.58]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q6Rkd-000jka-1D for linux-riscv@lists.infradead.org; Tue, 06 Jun 2023 08:09:13 +0000 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230606_010911_738968_782A83D6 X-CRM114-Status: UNSURE ( 6.18 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org 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(-)