Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2310325lqo; Mon, 20 May 2024 01:30:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUAyLLSq4Q4YbVHz07fT5CPH4G7ay7x7tLLu4n2uQCs1+g7rZYOqwGihebip+x/v++YTKN+xcwuENA8cpVlj7gB6szq2dNIZud+PE7iKA== X-Google-Smtp-Source: AGHT+IEdxJwKAAN0Pc6yNsnQQWRBUt8vf9oHywAoPYqFyw9tzRwwTOj1FMDKToVUBby3Ne6wvbRQ X-Received: by 2002:a05:6a20:551c:b0:1ad:746:b15a with SMTP id adf61e73a8af0-1afde1c5775mr22798766637.47.1716193824671; Mon, 20 May 2024 01:30:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716193824; cv=pass; d=google.com; s=arc-20160816; b=keRbMjYM91CHDCp+9zoDvbmCKwjqNwn+2npFoDohSaS7Lcdt3UE5zqwIz/6zMubipK p4lK0TigITxT+swNtov+thKkG6mz8aQTP0+g2ffkHPECi9RNJ6EYJt/1aWi8jv66LG4s 2fJbtOuB4RCLXGwTAal44LQlGd8jeN8Df2NR7EN1Uo4HiK8e2NceCPVkOORwe7FJ3AIp Fc92A0lkrS1+MN3zcVsTebKT7x2ljcqZs75zXRoanGja38UcOFASGd92b/FuZlfYfOya JKF0YfsbtOAhAD7qLjCP/+MbdonUuFb51/TRzOVW/Vs7yoaid0Gbh7pNcD+k1dLGeIxF ZzVA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=K3/H26ugfi749Iso620GWcwRHXKuJ0GDNWWDX00u2LI=; fh=VaZeVgaFcx8SErmQ+YqQVGFejd+RdeFdtBRNX8S3TDk=; b=PlAT7uaad//aVy62ZKa1cjETyGeNRy0FPEc4RbSeRUpjk4yowV9W4Vh5iT30J5nBeu 5/hC87IGaWywkStakhi7RSGKMkHKyd/aLnyeuDTxVUKtFf8eE1gh1NWSPJHOl5JSMIHi iR9OA3S45BOvd2jn4qBAwExZ/2iaPNkn2JOurWF0ubVAs7dMInogCFgLRon2YqauTR0J 7J1YiHQbR7WF48H8M5sqXvhnTWPxzlPErDEDq7i6tWNWp8fdU0dPfxHEDsOQ3ZoofyNk sDJxN+4PFU3a+gfrrQWuxE9fYyQIO6fAbcZcrhGM6i2RBlEQv0z9/3nyr9lYZ/olTNgU FJoA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=fkEd3pvG; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-183494-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183494-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2b628a5c324si2569776a91.42.2024.05.20.01.30.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 01:30:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-183494-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=fkEd3pvG; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-183494-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183494-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 43471281831 for ; Mon, 20 May 2024 08:30:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A09DA1BDC3; Mon, 20 May 2024 08:30:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fkEd3pvG" Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 495016AD7 for ; Mon, 20 May 2024 08:30:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716193816; cv=none; b=Tl4Tx+PNVRZl+30HDBs0WrGSAX12f/YHh3yAymQVTRmoiZyc7z1DO+Xj6GV8YcU0Ea+VXUwRBGeSYBbQd4WlX08LzG2rIo2Njb2mxF6V7QpmhacP6eMPAkRTrenimWb52HLt/eCSy5Bk0y/W1wUlA2/iTz6Xqo2P2QWyu9QZZnQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716193816; c=relaxed/simple; bh=v6Iyqtc8wfN1VDirNIoRyLWxOS50eG0jPJIfKCj8GPY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ARantpqidXEAuIE0mAbvwyV4xEL8bWUvoGMcF0V3D6/DiO6MGDyc4/2rciuHt30B032zSnOhJD7Haj9mdesTqbP3kC1pvu6G2OYnpRzm7QuCHgJ4noPSNmB/t3xvq5oMKYdJdYdOH1dNY3GUQjLUHDZ/HUBP/ckFN8P/75tYbpQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fkEd3pvG; arc=none smtp.client-ip=209.85.221.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-34db9a38755so2283757f8f.1 for ; Mon, 20 May 2024 01:30:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716193813; x=1716798613; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=K3/H26ugfi749Iso620GWcwRHXKuJ0GDNWWDX00u2LI=; b=fkEd3pvGdNeZu/zPwfi+cSkXMyDdfU9lpaLMx4g+xVurDDBscyH8JViQ5NU9pQdILw SG9bNOI06G1D6KYgqJyFl2vciqq/mH+/diDgfg1WxVgDU1XPnaNVUf8WRuXyyDYixZCn mvkSNoZfcpw2RM2UXLCKFAAIz3cn3gO6gddUQxDKO1xw1Z6/qt/E/cUkKtPaE1RiYEJU kkWcIDayKM5ume548Iwui8Bc2AbxiPqonMk2xQXVjUyrlp9Cf/VUDnJTDkRlBktVvlEL PPtnUlW/HoOBPgxL/eIiX+GHxIBNvMduY7ULGPrzO2EZPnvicw4YycRnFLoiKuCO5Oii 6WTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716193813; x=1716798613; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=K3/H26ugfi749Iso620GWcwRHXKuJ0GDNWWDX00u2LI=; b=P+po5kYScmQPIU6ENGYKWvRpIu6shKtplLmo148/RrOl4yHr5wmX668nftBjRgpTq5 dKEBrB0EQKRdTNicUTWloeHUl2GukPta2R8R8zWArG2Ar/ZFMnkdBz48CfTauhSbEfGy FQh274avNaT+wz6HcYtQEir5GiMRTsotscU0Nia0C+GOz/gx38KFYPjlKcd+nYc2N5Hq NvxqumhUf1hTE0ma5s6rnMpH3ZMnun/57wWrJEb5rYai6MkBXJJspk07MTpsY5x4DRFH 5r2iyTgCoFiS/m74Bzqsxbtd/64PpAgs2q1iz7/dcAP5TROastUGGoadRZ/1S3Q+dVPH oT7Q== X-Gm-Message-State: AOJu0Yx6oU571fva9aZBgXvOrikUBcFMGsTLzLvNeQOIxQYMe86kJscn GoD3oTwH8/q2ZbtuBLAhDK50e3DZKOxkdKOyqVhXnqju8ysVTh/aippcymnv X-Received: by 2002:a5d:530a:0:b0:34d:9aca:f4bb with SMTP id ffacd0b85a97d-3504a73727bmr24212026f8f.19.1716193813139; Mon, 20 May 2024 01:30:13 -0700 (PDT) Received: from fedora.iskraemeco.si ([193.77.86.250]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502bbbbf9esm28376437f8f.91.2024.05.20.01.30.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 01:30:12 -0700 (PDT) From: Uros Bizjak To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Uros Bizjak , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" Subject: [PATCH] x86/boot: Use current_stack_pointer to avoid asm() in init_heap() Date: Mon, 20 May 2024 10:29:55 +0200 Message-ID: <20240520083011.135342-1-ubizjak@gmail.com> X-Mailer: git-send-email 2.45.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Use current_stack_pointer to avoid asm() in the calculation of stack_end in init_heap(). The new code is more readable and results in exactly the same object file. Signed-off-by: Uros Bizjak Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" --- arch/x86/boot/main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/x86/boot/main.c b/arch/x86/boot/main.c index 9049f390d834..ac78f8c01908 100644 --- a/arch/x86/boot/main.c +++ b/arch/x86/boot/main.c @@ -119,9 +119,8 @@ static void init_heap(void) char *stack_end; if (boot_params.hdr.loadflags & CAN_USE_HEAP) { - asm("leal %n1(%%esp),%0" - : "=r" (stack_end) : "i" (STACK_SIZE)); - + stack_end = (char *) + (current_stack_pointer - STACK_SIZE); heap_end = (char *) ((size_t)boot_params.hdr.heap_end_ptr + 0x200); if (heap_end > stack_end) -- 2.45.1