From nobody Thu Apr 2 19:49:58 2026 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 1210AC4321E for ; Tue, 22 Nov 2022 16:11:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234262AbiKVQLi (ORCPT ); Tue, 22 Nov 2022 11:11:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234227AbiKVQLG (ORCPT ); Tue, 22 Nov 2022 11:11:06 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D6A2742F5; Tue, 22 Nov 2022 08:10:53 -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 ams.source.kernel.org (Postfix) with ESMTPS id CE5E7B81BEE; Tue, 22 Nov 2022 16:10:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1F77C433C1; Tue, 22 Nov 2022 16:10:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669133450; bh=9jyxmHpzfRCJJf9xQ03iz+bA0Xb5QCrz4P3JHsC5SMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SiQbk7Da54coI7gkcSa+od6Hd1M1+JjCaNn0sFqcdZG0cdtYNtk4vB1aTINWnfSt9 8rfTyvgy6vUlGqeeu5V9XjhwRYFk6HMOy3qCTv95SmUw5yT9d2q+aVSqDvls4VeF+X lsf6RLOVRNnFynZZZTkLyDyUO0XyFuDkCkvd8Pph1wBlGyUwdNnYA6Z6TQtrDqCNQw deqfbqofQxcCxHpuCxXeZIaoZ9daJ8BSrPgtgAVDx9kFudVMdf27mkrsWFvKRLD1gy TMFtctu/fcOjmw2cjOIIr+yUMzat1AipaE3kkWTNRTQobTcd8bdfxCZyltHtVEubWI QAjbhcijIwlUw== 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 08/17] x86/compressed: efi-mixed: simplify IDT/GDT preserve/restore Date: Tue, 22 Nov 2022 17:10:08 +0100 Message-Id: <20221122161017.2426828-9-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=1663; i=ardb@kernel.org; h=from:subject; bh=9jyxmHpzfRCJJf9xQ03iz+bA0Xb5QCrz4P3JHsC5SMM=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBjfPRabAmNoz2lPub2d3CamZQemKR8yASDbUtdoT/H Brr43omJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCY3z0WgAKCRDDTyI5ktmPJPUKC/ 4t4JhAxm00y83U+Wvv2lAqOINuqkTuhkErVDG15v2jHR+wYw30ix4IghLOwk1iSHqDv0w/bCgPztVD Vw40lqEejjuygLaA/IDUXmKps3vkdJ67GWwpm2mflPDVvXO9gkh9KcU5EmUbPNZIuzO8DBkI45Tfrx wPpTaTILzpbYKv3YH11CzTBHkd8rx8eE+rN4Gd6olfriIBjDReEb6sHyWZKk/kq8iGNDLiPrukp/+s ssN1Upypo9IgxpqwnBR/hAE4BU/uoGabIvrYVpZK7l9J8DiFa82SdRCyIzUcgGBUwkessJq8KMokyT htyKWur2fjznZRSYRAGPsP3xXAbciPsZQFTkTozwyeV3AuFdJldcTsLXLoIez2YElX/Epm0RhwOaUJ Zt5RvDMgD36pIqAN5xYqx/T40dY74SZaG9w4GQGMwUz+AX1gKo9DnYze0fxdNd2ATExubRqB7cv/i/ 2SxSKLq80PD+MvCg8gRWoksHrI7ioxnnKHmJrYSwvEj2c= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Tweak the asm and remove some redundant instructions. While at it, fix the associated comment for style and correctness. Signed-off-by: Ard Biesheuvel --- arch/x86/boot/compressed/efi_mixed.S | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/arch/x86/boot/compressed/efi_mixed.S b/arch/x86/boot/compresse= d/efi_mixed.S index 8844d8ed4b1c7561..8b02e507d3bb055a 100644 --- a/arch/x86/boot/compressed/efi_mixed.S +++ b/arch/x86/boot/compressed/efi_mixed.S @@ -96,24 +96,20 @@ SYM_FUNC_START(__efi64_thunk) =20 leaq 0x20(%rsp), %rbx sgdt (%rbx) - - addq $16, %rbx - sidt (%rbx) + sidt 16(%rbx) =20 leaq 1f(%rip), %rbp =20 /* - * Switch to IDT and GDT with 32-bit segments. This is the firmware GDT - * and IDT that was installed when the kernel started executing. The - * pointers were saved by the efi32_entry() routine below. + * Switch to IDT and GDT with 32-bit segments. These are the firmware + * GDT and IDT that were installed when the kernel started executing. + * The pointers were saved by the efi32_entry() routine below. * * Pass the saved DS selector to the 32-bit code, and use far return to * restore the saved CS selector. */ - leaq efi32_boot_idt(%rip), %rax - lidt (%rax) - leaq efi32_boot_gdt(%rip), %rax - lgdt (%rax) + lidt efi32_boot_idt(%rip) + lgdt efi32_boot_gdt(%rip) =20 movzwl efi32_boot_ds(%rip), %edx movzwq efi32_boot_cs(%rip), %rax @@ -187,9 +183,7 @@ SYM_FUNC_START_LOCAL(efi_enter32) */ cli =20 - lidtl (%ebx) - subl $16, %ebx - + lidtl 16(%ebx) lgdtl (%ebx) =20 movl %cr4, %eax --=20 2.35.1