Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6786779rwd; Tue, 6 Jun 2023 01:45:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4VpQDfXuqHoX9T3ZgrNEDXCfWKgjAdp1XgcQ/s71zzh+JzNxnk8tUbTkcacJGKW6zx99em X-Received: by 2002:a05:6214:2aa1:b0:626:33bb:3fd3 with SMTP id js1-20020a0562142aa100b0062633bb3fd3mr1277161qvb.19.1686041113726; Tue, 06 Jun 2023 01:45:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686041113; cv=none; d=google.com; s=arc-20160816; b=uRmuPgu2xiVxWFqlrwqd7ciXGm4CvLks0ykiOxQusgFjCBS+4jmN5fUnzVDdsYv1gB S19jIXdmRJFAbxplQN9cPIf43iEn31/PtLCd3GU8RjrDyM8LpApyt6TWOXs9W5U3ckls yMEsyobGoGlRlZ8bhvR5XePG4+3f2NhR1zrlsNuEWNCBns1Qq4YMPW+WOQw1j95kJ6VQ xTUrMlIvj+jlB23rUSn0gV0vYx7PRTxslVMP8Kg9K07EUq7n2FH9mMiPWoc8PLM4RQU+ KFYBlV5/ftRQYiCnulLSR+1oHLsDiFZliD/eQRH/OyEWU5UJbUm7qrtWFtCVxwF8YiBK 5jmA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c6-20020a056214224600b0062869a7b148si6075297qvc.443.2023.06.06.01.44.59; Tue, 06 Jun 2023 01:45:13 -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 S234998AbjFFII7 (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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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(-) -- 2.25.1