mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-05 16:37:50 +00: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 <ardb@kernel.org> Signed-off-by: Borislav Petkov <bp@suse.de> Link: https://lore.kernel.org/r/20221122161017.2426828-10-ardb@kernel.org
This commit is contained in:
parent
630f337f0c
commit
6aac80a8da
1 changed files with 2 additions and 6 deletions
|
@ -733,7 +733,6 @@ SYM_DATA_END_LABEL(boot32_idt, SYM_L_GLOBAL, boot32_idt_end)
|
||||||
*/
|
*/
|
||||||
SYM_FUNC_START(startup32_set_idt_entry)
|
SYM_FUNC_START(startup32_set_idt_entry)
|
||||||
push %ebx
|
push %ebx
|
||||||
push %ecx
|
|
||||||
|
|
||||||
/* IDT entry address to %ebx */
|
/* IDT entry address to %ebx */
|
||||||
leal rva(boot32_idt)(%ebp), %ebx
|
leal rva(boot32_idt)(%ebp), %ebx
|
||||||
|
@ -742,10 +741,8 @@ SYM_FUNC_START(startup32_set_idt_entry)
|
||||||
|
|
||||||
/* Build IDT entry, lower 4 bytes */
|
/* Build IDT entry, lower 4 bytes */
|
||||||
movl %eax, %edx
|
movl %eax, %edx
|
||||||
andl $0x0000ffff, %edx # Target code segment offset [15:0]
|
andl $0x0000ffff, %edx # Target code segment offset [15:0]
|
||||||
movl $__KERNEL32_CS, %ecx # Target code segment selector
|
orl $(__KERNEL32_CS << 16), %edx # Target code segment selector
|
||||||
shl $16, %ecx
|
|
||||||
orl %ecx, %edx
|
|
||||||
|
|
||||||
/* Store lower 4 bytes to IDT */
|
/* Store lower 4 bytes to IDT */
|
||||||
movl %edx, (%ebx)
|
movl %edx, (%ebx)
|
||||||
|
@ -758,7 +755,6 @@ SYM_FUNC_START(startup32_set_idt_entry)
|
||||||
/* Store upper 4 bytes to IDT */
|
/* Store upper 4 bytes to IDT */
|
||||||
movl %edx, 4(%ebx)
|
movl %edx, 4(%ebx)
|
||||||
|
|
||||||
pop %ecx
|
|
||||||
pop %ebx
|
pop %ebx
|
||||||
RET
|
RET
|
||||||
SYM_FUNC_END(startup32_set_idt_entry)
|
SYM_FUNC_END(startup32_set_idt_entry)
|
||||||
|
|
Loading…
Reference in a new issue