Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6074419rwb; Tue, 22 Nov 2022 08:27:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf7atYginZnETd7o8K97DMOUp1GJwqwIyytjhI8yLGN+q78D5/Li3EcRbyc9b55av84+zI0C X-Received: by 2002:a17:90a:880f:b0:212:e996:704a with SMTP id s15-20020a17090a880f00b00212e996704amr31608285pjn.13.1669134421423; Tue, 22 Nov 2022 08:27:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669134421; cv=none; d=google.com; s=arc-20160816; b=m410SHh8NQUera4h6GrMU4HE+M4mBDR+vIGBuIvfJdnmWMUt4K84tOR9xeTC67ZjpK Ue6Y0yxYQXQGffIM3zxJYgv6T/RSiuK79SxmFOsB+Mb+YQQ7M1GC6dNCRo4ZZ15st2SK zcGjGdA8at1dSQYEqWwya9DTyUbodO9SBmMlpmkLM8ERiiNGPDboadXyXRVXOqZfckiw X3YHjsgy+kN1F7/+WYIj/D5Dt9Mc0KMN0RF8CtOz3Myqs5jbM4kJKAoRtx9hMZNwo8XH mLjRP65ThnAnheHIAzR7NrYIE5XCTuj0QczZd4HfGeY9NOnD1FJD4Rw/KRq3GNPAkP6m MdWg== 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=eGmtjH1DYmdXTysjVmKBPajcgK4WcVX2EMZGVsuvpmU=; b=p6cEozTRW2KLWO4D4bUj/CcwUGL5AZ2eKCFQJTJzXyESLKbqdxmYs8Fzvd/fsxBvud Pko/rMKe3BnEuJV6fmK6CQB7X7U5GcmWTVdqywnp/FcQzW8ZxXwTvcy//CyQU4CoupwD 2YFtZAWSYP823PZvs11fDotYWVnW221rDgItpAXt1lt/zsc9Ysldp4kvc/x2Phaoi24o 4rxsoutvIJKJ0SqZb6CaWjWfRHYiNJDwUI9iaWdEF/Z9PUn+cdJGLGdPi1yOQypbretX N4r0WMT/vjav6otaHDjmwX/bfYpAkJsNA6M23qEh5AQCX2g6djzAwq5gWVz0SGTfwSD0 t1KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rP8QYEhs; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cq17-20020a056a00331100b005712b7c5b2fsi12534914pfb.78.2022.11.22.08.26.49; Tue, 22 Nov 2022 08:27:01 -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=rP8QYEhs; 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 S234301AbiKVQLk (ORCPT + 91 others); Tue, 22 Nov 2022 11:11:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234252AbiKVQLG (ORCPT ); Tue, 22 Nov 2022 11:11:06 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0B7A742FA; 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 dfw.source.kernel.org (Postfix) with ESMTPS id 69CDE61740; Tue, 22 Nov 2022 16:10:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13562C4347C; Tue, 22 Nov 2022 16:10:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669133452; bh=ZQv9+X1iJK9wCaH0UdAvPwmkreYOyHzQ5yoM8JDBf4A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rP8QYEhs/Yv0vTP+DydzJhp++6EoqkR+xXkXY9SUY5zVuPKW1OBmTPtU0HKQx9RfQ l8QCamavVEscgs9v9wyLMTuoMUeqMnoayuFBcYlKI15qaAyZD15DJlYJJxqlTmRr7N 1N2iMl0xAskzGmrLhzq7+E3uyNBBy9aP6jve3ps7wf3SB1xOHQDIBLrxAlQ8bKSd9+ Ggt/pt5ISA0QROeCTn4ygrZ8dAs1BNJlchPnuhJsFVAPD6fsUSLnpOGBgV5wMT0thI WD/d367a/gVrSUGleowaH3aEm3ohjc2xSP/Hkagm+Fh2D/AR+Obbvtrj9EFve4I9Xv DXcMAPhz2tPiQ== 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 09/17] x86/compressed: avoid touching ECX in startup32_set_idt_entry() Date: Tue, 22 Nov 2022 17:10:09 +0100 Message-Id: <20221122161017.2426828-10-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=1572; i=ardb@kernel.org; h=from:subject; bh=ZQv9+X1iJK9wCaH0UdAvPwmkreYOyHzQ5yoM8JDBf4A=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBjfPRbNOEMtTo47vx2jAN2Z59KRsBmjvCYdb205ac7 Cv/CzdaJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCY3z0WwAKCRDDTyI5ktmPJMBhC/ 9YvZjPjTtVifhaj3PVkOErn74GJ54+p0Yk1QiI2OSd+mr6sNcibNqgldEtqhOUXOpWxoNUld2Na7sx TbCsuvenJqmE6G3NX3B/qpnikHYnLm9vjgoZPxIgGFkBA5iIf9WF3wY3kl/31Pw7XkGoFFGyXODjs0 tWeAVgmWJE5S0RQodZ6fQUuESapXpwcobXuJUslwDqhgtUMKm8o9itj+FCEb1XuWU98LzzMJFLa48D Yek7l/df2rVTYUcybGjCVVBqqUMoAeoU6/5oQRTW9k7OmccRfXY1KimPLtujCGYwdD4mVjGHyWxnZP o3szwaE70Fp6vDbxvjLslV4Z0yadrsVJu/O9EdMLpSwuT3AFi3T505Vv0EcN97T59J2rRWDnKUr/AC L9EvMhOsePPNQo7NdixlnvUVCjR1D9gdTQ+tyejktKrDnL2pX41YPpeq6f8Zu7yJ1mX+efsXDluYz8 cbNV+G80miTg9qaZX2m3WE9CTqQsGRBr2xpwCkI0d8Mf0= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 Content-Transfer-Encoding: 8bit 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 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 --- 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 66ad3ab802ca9d0c..f31277f455e63f5f 100644 --- a/arch/x86/boot/compressed/head_64.S +++ b/arch/x86/boot/compressed/head_64.S @@ -741,7 +741,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 @@ -750,10 +749,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) @@ -766,7 +763,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) -- 2.35.1