From patchwork Tue Nov 22 16:10:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 24454 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2302214wrr; Tue, 22 Nov 2022 08:14:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf4hBlJiwDsSadnxnZlOhbXFZjdCUlR0bky1X5c5/140u6tdQ8Risccq+pZWSzmydjS74YYA X-Received: by 2002:a62:1d05:0:b0:56b:a0f4:decc with SMTP id d5-20020a621d05000000b0056ba0f4deccmr4628900pfd.33.1669133668469; Tue, 22 Nov 2022 08:14:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669133668; cv=none; d=google.com; s=arc-20160816; b=avwLWOD7qooeE96xqzPa6adLesjBMCzktNxuH6RPvYex2DHL6rTwT+LiU9ZJ0Ycb5a zlRWvzUcsYFKdhIRrB3NFLZN9+AeV1moTvPxoj7Rg371FhQfqHNH6FyoeV+vpSGdXDSo OWVPSK3k7hu9VxKX/RkT58gPen+wuPGrnUkYf+8W9+goFcTzvVbClWCI9MSWaFxJDTKb RLozAkvO8olJCnLcBq4H0qj5lISb0rvueGmmOSIWe/Fkvf6zwqBISc4Bcl4JqnL4cjP4 JTErmJb9eN/gbzs4kI/xmkCCNL7NANotFsDxo1JE42X2qcNrCMpVHIukjgBEZjSrG0nf ihbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2foFmAgi7GriMLTTuHx3ErMhaJFUBhKZn4kLnZeD/2s=; b=PjsNr3EE4AzOgVr/Vp9sIHIf86qcvdz2C3fHZUfjAPfu7giGlwl0yo52WIASp4WNuw 9Mu/NObEfktRby95aR04m3A4+EmfFG4/gJpHyVZT/BiFcXRLCmL+mStxJME2Di8eJ0Eg OjltefZd/CHdo4BDRkwQ73+ZxzpvB9Vp7cFcs+KFKJZeczFQjWJiP8OEAxQSa5NjBYuM PSKPvyMkGUQjjXMwVgUsP6G9gIh89t4l+k4/sbd5zwWBBNhOHh6SnptBpdCa5hxFZOJP BLacDKgWik9E9nxyLHZBBciakqS7fy/SxF8Cyj67sH8NFDVo3qs5DraFc2Zcicq5Olxj Lq8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uQ+tTtbA; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j70-20020a638b49000000b00439f026cf5dsi14185224pge.612.2022.11.22.08.14.14; Tue, 22 Nov 2022 08:14:28 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uQ+tTtbA; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234104AbiKVQLH (ORCPT + 99 others); Tue, 22 Nov 2022 11:11:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234218AbiKVQKr (ORCPT ); Tue, 22 Nov 2022 11:10:47 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B82DD73B9E; Tue, 22 Nov 2022 08:10:42 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5480D6178F; Tue, 22 Nov 2022 16:10:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF810C433D6; Tue, 22 Nov 2022 16:10:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669133441; bh=Ff5jCPG7xec1bYIqVhOuQrRSDrmeAGMIZG5Ihg2Q08o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uQ+tTtbAAF3gK1Z6QRv+7Rua8R7XrcZdrvKax7QpETrOgkP1VQlxLolXvht/ciO8O d+de/y8s3jBkTNAC13F/qQKQxm+QbyHXfSwWk0YIn3cDSkC//L5Rji0brkgNYn4e4E rpTPnuiEMdujYFmubTEaNXeamv7qe0L8fZt9YPIvcqrdjbu1BRkkWQzfW8v9YI0Oqp rkX/rU+toIj0kaSvENvVtvgBODb8DbqLkEexk2c3RTrPyIo50DDjj4CWesYeEzVKvi ufg3ZjWJRXAqKgGaS90MAijfmzwZhO2M89xSkmIqPtBVAQuUndSOwXioZlhfcICXll C2TH6rT1Zl8Ug== From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Ard Biesheuvel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Michael Roth Subject: [PATCH v3 04/17] x86/compressed: efi-mixed: move efi32_pe_entry into .text section Date: Tue, 22 Nov 2022 17:10:04 +0100 Message-Id: <20221122161017.2426828-5-ardb@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221122161017.2426828-1-ardb@kernel.org> References: <20221122161017.2426828-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2019; i=ardb@kernel.org; h=from:subject; bh=Ff5jCPG7xec1bYIqVhOuQrRSDrmeAGMIZG5Ihg2Q08o=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBjfPRU1Ky0OuKT3C0YzcqKH54TQ0hcBdzSXviTD0O7 qRY21+aJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCY3z0VAAKCRDDTyI5ktmPJAIKDA CjCnzWb+eCyL4Ncuo9hhAheTq2FnzM8m9qA7gAzdx5U8kOyllXOxNTzHBlEKOy3R9VBbrrMuMXO8iD /tL5oTNLSNF2G3jrz7f3broaBBy6YDICuj7a173PMQbObuhCavTAp+iTn7ktiPokRPhYSFBreNORHp lOdy48mVsL4blMjJ7JbjUBHoVt53G0j3GMg69PzfcYUk7dhTXJ5S+x+ik/kGVMlGi8kotybbZ/SQgD EuC7EXoRQKvFp3TO/K3J1DI9vFghLvg2CZaa9m3d8SfSk8NCOq75eRZN+49YQ19Gs/3ZgkU1t9E/xZ aVBXM7A6CQV7vmDrajWyEHwVhN6artR4sM9U5v18gzPLl3ZsyszB6W2Je2qeVV7b++rOee3qPweOBB EMRhA5IrRzcUtG9RiCPK0ZvsVIGypyORoDC49E6TJOzwjAZPzptFRfXu7r3/HV7iR1ED5RHPqjmafL 9aUa3WCOk4fVkJMrFDkVwitBSaX8qyHlZtk4Wv9rUaQzU= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750213505655423608?= X-GMAIL-MSGID: =?utf-8?q?1750213505655423608?= Move efi32_pe_entry() into the .text section, so that it can be moved out of head_64.S and into a separate compilation unit in a subsequent patch. Signed-off-by: Ard Biesheuvel --- arch/x86/boot/compressed/head_64.S | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S index b9dbc8127038c315..8192ab1c308567ce 100644 --- a/arch/x86/boot/compressed/head_64.S +++ b/arch/x86/boot/compressed/head_64.S @@ -778,7 +778,7 @@ SYM_DATA(efi_is64, .byte 1) #define BS32_handle_protocol 88 // offsetof(efi_boot_services_32_t, handle_protocol) #define LI32_image_base 32 // offsetof(efi_loaded_image_32_t, image_base) - __HEAD + .text .code32 SYM_FUNC_START(efi32_pe_entry) /* @@ -800,12 +800,11 @@ SYM_FUNC_START(efi32_pe_entry) call 1f 1: pop %ebx - subl $ rva(1b), %ebx /* Get the loaded image protocol pointer from the image handle */ leal -4(%ebp), %eax pushl %eax // &loaded_image - leal rva(loaded_image_proto)(%ebx), %eax + leal (loaded_image_proto - 1b)(%ebx), %eax pushl %eax // pass the GUID address pushl 8(%ebp) // pass the image handle @@ -834,13 +833,13 @@ SYM_FUNC_START(efi32_pe_entry) movl 12(%ebp), %edx // sys_table movl -4(%ebp), %esi // loaded_image movl LI32_image_base(%esi), %esi // loaded_image->image_base - movl %ebx, %ebp // startup_32 for efi32_pe_stub_entry + leal (startup_32 - 1b)(%ebx), %ebp // runtime address of startup_32 /* * We need to set the image_offset variable here since startup_32() will * use it before we get to the 64-bit efi_pe_entry() in C code. */ - subl %esi, %ebx - movl %ebx, rva(image_offset)(%ebp) // save image_offset + subl %esi, %ebp // calculate image_offset + movl %ebp, (image_offset - 1b)(%ebx) // save image_offset xorl %esi, %esi jmp efi32_entry // pass %ecx, %edx, %esi // no other registers remain live