mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
x86/boot/compressed: Simplify IDT/GDT preserve/restore in the EFI thunk
commit 630f337f0c upstream.
Tweak the asm and remove some redundant instructions. While at it,
fix the associated comment for style and correctness.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20221122161017.2426828-9-ardb@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
ef12d049fa
commit
88035744b9
@@ -96,24 +96,20 @@ SYM_FUNC_START(__efi64_thunk)
|
||||
|
||||
leaq 0x20(%rsp), %rbx
|
||||
sgdt (%rbx)
|
||||
|
||||
addq $16, %rbx
|
||||
sidt (%rbx)
|
||||
sidt 16(%rbx)
|
||||
|
||||
leaq 1f(%rip), %rbp
|
||||
|
||||
/*
|
||||
* 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)
|
||||
|
||||
movzwl efi32_boot_ds(%rip), %edx
|
||||
movzwq efi32_boot_cs(%rip), %rax
|
||||
@@ -187,9 +183,7 @@ SYM_FUNC_START_LOCAL(efi_enter32)
|
||||
*/
|
||||
cli
|
||||
|
||||
lidtl (%ebx)
|
||||
subl $16, %ebx
|
||||
|
||||
lidtl 16(%ebx)
|
||||
lgdtl (%ebx)
|
||||
|
||||
movl %cr4, %eax
|
||||
|
||||
Reference in New Issue
Block a user