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: 13268686 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20F09C7EE24 for ; Tue, 6 Jun 2023 08:08:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234798AbjFFII6 (ORCPT ); Tue, 6 Jun 2023 04:08:58 -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 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.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(-)