From patchwork Thu Nov 24 08:12:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 25355 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3258511wrr; Thu, 24 Nov 2022 00:13:58 -0800 (PST) X-Google-Smtp-Source: AA0mqf5xBrCpyxf39KoF4DcYqOBtKsqGQfj4JEHcwQji2Q98NBMfkdPgVOQtaZjX6JFVGsCI5MnN X-Received: by 2002:a63:4944:0:b0:46f:ec9f:dcb0 with SMTP id y4-20020a634944000000b0046fec9fdcb0mr13426902pgk.202.1669277638025; Thu, 24 Nov 2022 00:13:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669277638; cv=none; d=google.com; s=arc-20160816; b=wmTXa5Y4ve5pAR+MGTJiHEG5j2OluGJP6QLCj+9Eqz+hdoyMuKlMUAYJqVoB1wWqXu gmA3BcR8VeFQWeWp7aAPB7SYL5K1odMzNhz3pQyCBemj9qznr1EXS+ocIkBs2dn1rrYk T6KrO8TQgDX7Lq9b6uotuBuEbGNQs79Y1CMtXMk4QoWQ/upfeUlIobBELKcSSfUmp3ed JvEagDMsDGk0kX7reSg6EmruUgz4/TcOwV0f68fbSNGJcLZfrkPIF31POmNfZ9BDyJct 0ucAUZqHJIgieU5DokJnaNLjBx7YFJv1wLvkJ83+F23hl/lWM2WzENETB4xA6PmgdgQ+ aIuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=N6HscZAVCY8KRoZ6LIF2oha+45Vzc6klE8SeCIiiTso=; b=jOQFlbSMG/wZwvuvnYA00gxu+qTky3JNctdZAqZw4KGO++enWlikrcGtyK0yI6eS4G fAChTu47Jthh9iszmUva7eKhhHyucNFysygX6n49wOp59eFysxq0kbdc+j7PsPWPnNBA J4H9uj+T4eEuuZTw/7KciVhFmTSvZRkRsv6zgeAG4IMcLmbox3ho+3ujhplMSksfLdkL vu/LqgKXzUZbwnGChnPMyXdInoc4YfYG1F3ZJ6yMsScM4u2KO66dltvxxoJn+qPWgw39 acL0Ml0WylWL+i8mpYMtk/ReG7WQ0b4XOJ3KZI5P3e+rKciEZnoinZ7u9xnsKlt5VpAt Bdsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ATQ+0A8v; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g34-20020a635662000000b0046b0e168af0si677062pgm.597.2022.11.24.00.13.45; Thu, 24 Nov 2022 00:13:58 -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=@linutronix.de header.s=2020 header.b=ATQ+0A8v; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229939AbiKXIN1 (ORCPT + 99 others); Thu, 24 Nov 2022 03:13:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229844AbiKXIMh (ORCPT ); Thu, 24 Nov 2022 03:12:37 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3C09E6740; Thu, 24 Nov 2022 00:12:09 -0800 (PST) Date: Thu, 24 Nov 2022 08:12:07 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669277528; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N6HscZAVCY8KRoZ6LIF2oha+45Vzc6klE8SeCIiiTso=; b=ATQ+0A8vW6zNEWv/ZQgkiZqdCZGp6lLxbomoWEaU/0kJI43vUAx2eJp72v6vfAasO49BYl 4WupwJxz1QYREDvjHpHL0NPsvEyDZXGOT4H9q9mrH3FYzHT2YkclKpvSb/Qa35ljENuZvJ 4/uTY3yCrK85fmwRbdg7Nd4corpjF0Q4yWmZ3yMrQz2MKAEfAmyB0NoSn3gtB6AiAFMtgo ibaC3X5lrrtCVtzkbC9BYA70/6na90qjQUViTp2SbKkmU0hMs0G3XMeJBm8nzzJvW5WNZH 67kZe+X68vyCRZeFRGy4i8QV8k5J7OJPbPr5kTuroj6rXtpFM3zXc9Qogyq2HA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669277528; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N6HscZAVCY8KRoZ6LIF2oha+45Vzc6klE8SeCIiiTso=; b=BKqJLw2/1MoGTCjrRMULp92NtiPhMF5moLVSS+zdo2C3nNv3Z0+LrJJdH1OYj4d8fQpljv CJRd9YAMZqdQSQAw== From: "tip-bot2 for Ard Biesheuvel" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/boot] x86/boot/compressed: Avoid touching ECX in startup32_set_idt_entry() Cc: Ard Biesheuvel , Borislav Petkov , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20221122161017.2426828-10-ardb@kernel.org> References: <20221122161017.2426828-10-ardb@kernel.org> MIME-Version: 1.0 Message-ID: <166927752707.4906.15976854475607977987.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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?1750364468445065343?= X-GMAIL-MSGID: =?utf-8?q?1750364468445065343?= The following commit has been merged into the x86/boot branch of tip: Commit-ID: 6aac80a8da46d70f2ae7ff97c9f45a15c7c9b3ef Gitweb: https://git.kernel.org/tip/6aac80a8da46d70f2ae7ff97c9f45a15c7c9b3ef Author: Ard Biesheuvel AuthorDate: Tue, 22 Nov 2022 17:10:09 +01:00 Committer: Borislav Petkov CommitterDate: Thu, 24 Nov 2022 08:57:41 +01:00 x86/boot/compressed: Avoid touching ECX in startup32_set_idt_entry() Avoid touching register %ecx in startup32_set_idt_entry(), by folding the MOV, SHL and ORL instructions into a single ORL which no longer requires a temp register. This permits ECX to be used as a function argument in a subsequent patch. Signed-off-by: Ard Biesheuvel Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/r/20221122161017.2426828-10-ardb@kernel.org --- arch/x86/boot/compressed/head_64.S | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S index 34d0395..a2d1c03 100644 --- a/arch/x86/boot/compressed/head_64.S +++ b/arch/x86/boot/compressed/head_64.S @@ -733,7 +733,6 @@ SYM_DATA_END_LABEL(boot32_idt, SYM_L_GLOBAL, boot32_idt_end) */ SYM_FUNC_START(startup32_set_idt_entry) push %ebx - push %ecx /* IDT entry address to %ebx */ leal rva(boot32_idt)(%ebp), %ebx @@ -742,10 +741,8 @@ SYM_FUNC_START(startup32_set_idt_entry) /* Build IDT entry, lower 4 bytes */ movl %eax, %edx - andl $0x0000ffff, %edx # Target code segment offset [15:0] - movl $__KERNEL32_CS, %ecx # Target code segment selector - shl $16, %ecx - orl %ecx, %edx + andl $0x0000ffff, %edx # Target code segment offset [15:0] + orl $(__KERNEL32_CS << 16), %edx # Target code segment selector /* Store lower 4 bytes to IDT */ movl %edx, (%ebx) @@ -758,7 +755,6 @@ SYM_FUNC_START(startup32_set_idt_entry) /* Store upper 4 bytes to IDT */ movl %edx, 4(%ebx) - pop %ecx pop %ebx RET SYM_FUNC_END(startup32_set_idt_entry)