From patchwork Wed Jun 28 19:06:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 114026 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp9151046vqr; Wed, 28 Jun 2023 12:14:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7F27UhOUj5Bt6WI+Nt/+JoGCSXbgg0BIwqPGMPx9mOBV6irvWDiAmvZMeAKHLjq0RG8ht0 X-Received: by 2002:a17:906:779c:b0:988:815c:b9fa with SMTP id s28-20020a170906779c00b00988815cb9famr22558430ejm.3.1687979686059; Wed, 28 Jun 2023 12:14:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687979686; cv=none; d=google.com; s=arc-20160816; b=mmr7sEy2TqAhbok7rnZ/8Ied+G6wApS6Kz/UaDFgvf3LolxIB1HLO4Oqg/gV5M7o2W 0BhuzVp6OeU2d9chsGlTa4qevMz/U1ycxNxQ0SvZW70E3MudDFU+RBieBqAxUkacBH1Q x5E9Dzl0jKHcO1uXCopXJ0E5ruONhgtPRnY9kRTeZkqwh3pPzXhzJc0lW4yasN5Wwed6 juhLcaroXM3Oe6xlivzEfno24lTtyCJr/ViPyuIITrX2DmBARfLQZK9fLk9KpPPk+wTA zIQPf/YXGcpwlAlodooE6nQPR0yjWyQP2mGkfxrWoHiNZTDuWs6bJtEJz2y2k8A72CqM G7kA== 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:references:in-reply-to:message-id:date:subject:cc:to :from; bh=Hg2wKGhzi/c0SZRQEpJ+LXHSCcE7uRo/DKVX5ICM67g=; fh=jGpRxxGHkcGZyN2ZnaDwhUy8S6joixew3DGGT1L/CuQ=; b=q3Y65hKnXzMThZEj1ujM/63Sgl2G+DG4NW5rKbFyIhD6TnbBD5vaPw/2yILsBIw4mO 3drcR+2EyTUpQzAXS753hLGKKXOvPSmEboIyok4GeKdRSi86PcJ0K+4+7ZbmXqj/FU6U /6gQHontpunwtAX+hd6puuVbWhgb7v6ypF4j1GMnKI7F/zZFoHg+oIdnuO4PvURg+1V+ TzCvIhrzGCw5cW/7FtP1kHnkzCIJAZ6aLObWqkfA14/YS6HOL1OrlI/IT1/e8TzVLFjM ZkAx7LoqIQfNAkGp0QRCbOF/xFdU/kBdYJKz68dO0MvBAzYVEnRcMWRqapxB3GU0dywQ IdKw== 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 lu13-20020a170906facd00b009929d998ab3si494915ejb.734.2023.06.28.12.14.16; Wed, 28 Jun 2023 12:14:46 -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 S232194AbjF1TH3 (ORCPT + 99 others); Wed, 28 Jun 2023 15:07:29 -0400 Received: from bg4.exmail.qq.com ([43.154.54.12]:53345 "EHLO bg4.exmail.qq.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232160AbjF1THG (ORCPT ); Wed, 28 Jun 2023 15:07:06 -0400 X-QQ-mid: bizesmtp79t1687979217ti593xid Received: from linux-lab-host.localdomain ( [116.30.129.193]) by bizesmtp.qq.com (ESMTP) with id ; Thu, 29 Jun 2023 03:06:55 +0800 (CST) X-QQ-SSF: 01200000000000D0W000000A0000000 X-QQ-FEAT: D2GZf6M6C/jblY5+ez24uRSJrc6onlFKbVGlqPu9gz4C5VaEsHfPYV/+NbYNT M1xzvZvpUGVdU4m30V11Y032mXFLtuUBz/mtlNUDT78V8fQ/lc5cTGseyv0F/f0q/eI4FDb B2FbUnR/M5UMRVoi8g9xzAxpolnLJoudK9vMmMuJQ7xcbx68I+AHVvjOFo7ArkDBmY72K17 WpFiuGChYRn7DpN7ps7SrQCzwKzxAB0mOSMBUknzBEI0mP+u/OoB2NsfF4nMJXSIwPhcSgK uX/3Z74F0cX7AiF4lVQeTGYbg+K8doDPqbNQ/9SiL4iEP7soaPyeIgLaT2FvFSs8jnE9qSo Xd1YNJ9b6NQ4Od4okJQhNXhT4z0+qHgCdh0Nj/WbL1NR+KM2wI= X-QQ-GoodBg: 0 X-BIZMAIL-ID: 18249731880678126887 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 v1 11/11] tools/nolibc: s390: shrink _start with _start_c Date: Thu, 29 Jun 2023 03:06:44 +0800 Message-Id: <2a63942b938ce0f016f3411f7c0d4b0c0d512e74.1687976753.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrsz:qybglogicsvrsz3a-3 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?1769974987278060684?= X-GMAIL-MSGID: =?utf-8?q?1769974987278060684?= Let's move most of the _start operations to _start_c(). Signed-off-by: Zhangjin Wu --- tools/include/nolibc/arch-s390.h | 35 ++++---------------------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/tools/include/nolibc/arch-s390.h b/tools/include/nolibc/arch-s390.h index 5139e0e37e56..a28f94aa28ca 100644 --- a/tools/include/nolibc/arch-s390.h +++ b/tools/include/nolibc/arch-s390.h @@ -137,41 +137,14 @@ _arg1; \ }) -char **environ __attribute__((weak)); -const unsigned long *_auxv __attribute__((weak)); - /* startup code */ void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) __no_stack_protector _start(void) { __asm__ volatile ( - "lg %r2,0(%r15)\n" /* argument count */ - "la %r3,8(%r15)\n" /* argument pointers */ - - "xgr %r0,%r0\n" /* r0 will be our NULL value */ - /* search for envp */ - "lgr %r4,%r3\n" /* start at argv */ - "0:\n" - "clg %r0,0(%r4)\n" /* entry zero? */ - "la %r4,8(%r4)\n" /* advance pointer */ - "jnz 0b\n" /* no -> test next pointer */ - /* yes -> r4 now contains start of envp */ - "larl %r1,environ\n" - "stg %r4,0(%r1)\n" - - /* search for auxv */ - "lgr %r5,%r4\n" /* start at envp */ - "1:\n" - "clg %r0,0(%r5)\n" /* entry zero? */ - "la %r5,8(%r5)\n" /* advance pointer */ - "jnz 1b\n" /* no -> test next pointer */ - "larl %r1,_auxv\n" /* yes -> store value in _auxv */ - "stg %r5,0(%r1)\n" - - "aghi %r15,-160\n" /* allocate new stackframe */ - "xc 0(8,%r15),0(%r15)\n" /* clear backchain */ - "brasl %r14,main\n" /* ret value of main is arg to exit */ - "lghi %r1,1\n" /* __NR_exit */ - "svc 0\n" + "lgr %r2, %r15\n" /* initialize stack protector */ + "aghi %r15, -160\n" /* allocate new stackframe */ + "xc 0(8,%r15), 0(%r15)\n" /* clear backchain */ + "brasl %r14, _start_c\n" /* transfer to c runtime */ ); __builtin_unreachable(); }