aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArd Biesheuvel <ardb@kernel.org>2022-11-22 17:10:09 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-03-06 14:45:13 +0000
commit530a4271b7ba5776b7f5a67015ae63a3ba3d2348 (patch)
treec9eccd194869f7b3f9b00c605c1b66b65eea64ec
parent88035744b91a187bcc23253a73ef3b1ccc08a2f9 (diff)
downloadlinux-530a4271b7ba5776b7f5a67015ae63a3ba3d2348.tar.gz
x86/boot/compressed: Avoid touching ECX in startup32_set_idt_entry()
commit 6aac80a8da46d70f2ae7ff97c9f45a15c7c9b3ef upstream. 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 <ardb@kernel.org> Signed-off-by: Borislav Petkov <bp@suse.de> Link: https://lore.kernel.org/r/20221122161017.2426828-10-ardb@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--arch/x86/boot/compressed/head_64.S8
1 files changed, 2 insertions, 6 deletions
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
index 2235c3a13f547e..e90cbbb2903d99 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -749,7 +749,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
@@ -758,10 +757,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)
@@ -774,7 +771,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)