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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9AD45C001DE for ; Tue, 25 Jul 2023 18:23:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231126AbjGYSXr (ORCPT ); Tue, 25 Jul 2023 14:23:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229478AbjGYSXq (ORCPT ); Tue, 25 Jul 2023 14:23:46 -0400 Received: from gnuweeb.org (gnuweeb.org [51.81.211.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C9722125; Tue, 25 Jul 2023 11:23:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1690309424; bh=zFYIq3Co+qyjUFECaDvYffNEVwgRI5mFYW9PtEP+uK0=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=eoDm3Ym4Qx5pjUZWAFgCt4ofah1FYk3awUDh+ekYujvpyTGZf52VD+YfR8KyFpVP5 pz6ZEvUN2uLluU9axncC8/Lf7LbFgzXTSJDf30fnPZyD17cRSCpu4pm/BNEByz1CKQ 3Cg3pGCC0GMqrxycvOldTcIg9SNM1VK74SKpvqeZTZB/WckOz1Z4LINyPcCxxKTlwb zJoyVODPj1+WOfjsJbbSkVTGXNqipDa+TbgC2wfZ+BUvHI0+HnySjqhTcgmOSFgVHz 8pWxSGZNisokbnTaoLQhZSMsomiQOs7IATZHe/chNRhD54BEJ8ACyAdvwuTNOQCCNN 65+FXtaNkODkQ== Received: from biznet-home.integral.gnuweeb.org (unknown [182.253.126.67]) by gnuweeb.org (Postfix) with ESMTPSA id C982E24AF9F; Wed, 26 Jul 2023 01:23:41 +0700 (WIB) Date: Wed, 26 Jul 2023 01:23:37 +0700 From: Ammar Faizi To: Zhangjin Wu Cc: Arnd Bergmann , Sven Schnelle , Thomas =?iso-8859-1?Q?Wei=DFschuh?= , Willy Tarreau , Linux Kernel Mailing List , Linux Kselftest Mailing List Subject: Re: [PATCH v1 1/8] tools/nolibc: add support for powerpc Message-ID: References: <20230725170426.58050-1-falcon@tinylab.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230725170426.58050-1-falcon@tinylab.org> X-Bpl: hUx9VaHkTWcLO7S8CQCslj6OzqBx2hfLChRz45nPESx5VSB/xuJQVOKOB1zSXE3yc9ntP27bV1M1 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org On Wed, Jul 26, 2023 at 01:04:26AM +0800, Zhangjin Wu wrote: > My old 'reply' is not rigorous, since the syscall6() uses stack to pass > the 6th argument, so, our new syscall.h didn't support it currently, > the syscalls I have tested about "=r" instead of "=a" were only syscall1-5(). Yeah, it won't fit with the new design. i386 runs out of GPRs very quickly. Given that, it had a hard time implementing syscall6() properly in nolibc. The calling convention itself actually doesn't require stack for executing 'int $0x80'. The reason of why it uses stack is because the %ebp register cannot be listed in the clobber list nor in the constraint if -fomit-frame-pointer is not activated. Thus, we have to carefully preserve the value on the stack before using %ebp as the 6-th argument to the syscall. It's a hack to make it work on i386. > Ok, so, with the new syscalls.h proposed, we'd better keep i386 > syscall6() as-is. > > For the left syscall1-5(), is there any risk when use '=r' instead of 'r'? Using "=r" instead of "r" doesn't make sense. Did you mean "=r" instead of "=a"? If that's what you mean: So far I don't see the risk of using "=r" instead of "=a" as long as the variable is properly marked as 'register' + asm("eax"). -- Ammar Faizi