Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1655651rdb; Sat, 2 Dec 2023 04:45:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IEmyR4DG30AMn2rTOjTBr/f2ggoLBN8gWmwU+Ft5ik8UE5F1eN6p4Y6HpFINquKpliIuNLZ X-Received: by 2002:a17:902:ced2:b0:1cf:ca7b:8ef3 with SMTP id d18-20020a170902ced200b001cfca7b8ef3mr1357103plg.11.1701521156179; Sat, 02 Dec 2023 04:45:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701521156; cv=none; d=google.com; s=arc-20160816; b=kmnHd5xat2YeGH3LUdRMpdiTbGviBam9p4aUMoP9GRaQ48yh689WI+ivGyM/+Mn103 qFaArBbMgnSv3l1G+3k5ngYdOsjMnVHGa55++x1eWPoL8PJ7XJ/dl1pSOs+CYwCY5T01 1eY4xq2QwYQGXeUTx9+vEC9vU3gPAFKCS09AYRrx0rIRB+tNHmvL4Kpds9tgq6N3f7/M PRQKFtT/rtZauublGJCEL99lv6YBQWClAH/DVO0uXInWD3V/iz0IhcIso5p/c/JIItvV KvRGmrnHSm/dH1hVi4PrmSdU7yE0iScfzYYS6g3D7HX6WftSLK86UuWsY7sHPbfLkELf kxRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=1g8MqwHZBgoNHWh+bYkNb6sIC9zXf19tQTXlJc9qQOU=; fh=C3p1y84NoTy63snxPjpHMdN9GmyIjPnfMy2Eaa+sWwg=; b=M7ms9QcHd8x6K5rGd+YBhIpmljGh6ZhkijvzHaAfV2gqpi9iw63uJz84RkFd4p70BB XqAHf1KYjzYoEDrW1sNKpVxZ374+f+FmlgXBEtmI0PCiakKy08HeoRLHFqqL3ui/8J+r n3et2XtD0K4Ru7kiF5i4UYfTmIIbaEQ5uQE7WaK8BAJ0EGY5kxXcni2q/GBO8A3yr50R 3gp3qiqbUj0bBHyb3BvDmVZO6OVWYpyI2gypl50Y2vUGMKJoy9Vok2Fsy+w5nPLmCrNR zmv5gV9ZE9U7G7HVe5yvWrSdEwPvKhDmzX64hlVeviW4LNEsOtJGX58oyJ/FZqheoroS h5cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CYkZ+IAi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id mf11-20020a17090b184b00b0028526216f31si5185909pjb.106.2023.12.02.04.45.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Dec 2023 04:45:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CYkZ+IAi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 7E352807C751; Sat, 2 Dec 2023 04:45:27 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232138AbjLBMpN (ORCPT + 99 others); Sat, 2 Dec 2023 07:45:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229702AbjLBMpL (ORCPT ); Sat, 2 Dec 2023 07:45:11 -0500 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A748184 for ; Sat, 2 Dec 2023 04:45:17 -0800 (PST) Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-a1882023bbfso392438466b.3 for ; Sat, 02 Dec 2023 04:45:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701521115; x=1702125915; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=1g8MqwHZBgoNHWh+bYkNb6sIC9zXf19tQTXlJc9qQOU=; b=CYkZ+IAixkiWTz0S2FqHBXNvQ6WQ29Wihd3rxHw/7hQSM7xyBki8h23POPGAXRubga x1vQboO7th1i7ZJi6Ou+B099ztmrfy8uL4vtf8NEHIFDtAUkk6rZFlxaZaiK0UwGQB5T DBY8mtehKl+Wn4DneWzIKX24SMy3Ri6PwUyDKZNmrTRE8Ki3Z4cZzSdALxPFnCkIlTgS hw7xZkE4XbLdQftoYWgedK9kyDxIzrV4bXTgrhAO9WDou3c7iJ4cVhTQ7pSgjucD2M+G k5xyotlIxKAEu6vcruUYh3mXSBdkLCUjbfBNh0fn5qrd4p73AgJfE+j0jX4+9ntmfFbh Q6FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701521115; x=1702125915; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1g8MqwHZBgoNHWh+bYkNb6sIC9zXf19tQTXlJc9qQOU=; b=q7ER4/fg+vOccORWo3TQRMAsDEgtZH9KbGZWeT4xya7Y+eHnTrgyPGIoy3rHPpG75N oc2cRK6X+4OwN2OokUcHfw0bWnc8sBzyon+3IMZzzoa/Ny3ggGFL4peCbdaDpYNcfwdI zbvby/J8j+KyT1Pv/tihuhC1jHlpHVzvsSP20Jg1jYBCquuLq7wa67GwmX/Sb/JgehAW TMF/I9lY5iNiJpLOmliCB86IJQ4VuvII2/cZZKe/sxcUpHHxMzCu6U/HTcvwvn4nZ9XH JxYrbHoWux+2SDxm/dE+kjkQnimjm0TQAS8lejfQjZdQTEE3CGKvpWCxzVo81R5pZ9A7 Is3A== X-Gm-Message-State: AOJu0Yz5Kr2Vm1Nmv5mEu/FSmC3FsT/j+xgOG97Nt1TrFPc17X3Nw5Fu KRq0fjf448idEmwJqpjPZ0BFI3jdMA== X-Received: by 2002:a17:906:fb99:b0:9e6:38f2:8439 with SMTP id lr25-20020a170906fb9900b009e638f28439mr1457788ejb.60.1701521115337; Sat, 02 Dec 2023 04:45:15 -0800 (PST) Received: from p183 ([46.53.252.219]) by smtp.gmail.com with ESMTPSA id qz1-20020a170907680100b00a1a25e756d4sm1658139ejc.107.2023.12.02.04.45.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Dec 2023 04:45:14 -0800 (PST) Date: Sat, 2 Dec 2023 15:45:13 +0300 From: Alexey Dobriyan To: Willy Tarreau , Thomas =?utf-8?Q?Wei=C3=9Fschuh?= Cc: linux-kernel@vger.kernel.org Subject: [PATCH] nolibc: optimise _start() on x86_64 Message-ID: <38183c29-9b7f-4960-8702-d71ce816cf80@p183> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sat, 02 Dec 2023 04:45:27 -0800 (PST) Just jump into _start_c, it is not going to return anyway. Signed-off-by: Alexey Dobriyan --- Also, kernel clears all registers before starting process, I'm not sure why xor ebp, ebp was added. tools/include/nolibc/arch-x86_64.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/tools/include/nolibc/arch-x86_64.h +++ b/tools/include/nolibc/arch-x86_64.h @@ -167,8 +167,7 @@ void __attribute__((weak, noreturn, optimize("Os", "omit-frame-pointer"))) __no_ "xor %ebp, %ebp\n" /* zero the stack frame */ "mov %rsp, %rdi\n" /* save stack pointer to %rdi, as arg1 of _start_c */ "and $-16, %rsp\n" /* %rsp must be 16-byte aligned before call */ - "call _start_c\n" /* transfer to c runtime */ - "hlt\n" /* ensure it does not return */ + "jmp _start_c\n" /* transfer to c runtime */ ); __builtin_unreachable(); }