Skip to content

Commit 9241dfe

Browse files
nivedita76ardbiesheuvel
authored andcommitted
efi/x86: Drop the special GDT for the EFI thunk
Instead of using efi_gdt64 to switch back to 64-bit mode and then switching to the real boot-time GDT, just switch to the boot-time GDT directly. The two GDT's are identical other than efi_gdt64 not including the 32-bit code segment. Signed-off-by: Arvind Sankar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent 6e99d32 commit 9241dfe

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

arch/x86/boot/compressed/efi_thunk_64.S

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ SYM_FUNC_START(__efi64_thunk)
2828
push %rbx
2929

3030
leaq 1f(%rip), %rbp
31-
leaq efi_gdt64(%rip), %rbx
32-
movl %ebx, 2(%rbx) /* Fixup the gdt base address */
3331

3432
movl %ds, %eax
3533
push %rax
@@ -48,7 +46,8 @@ SYM_FUNC_START(__efi64_thunk)
4846
movl %r8d, 0xc(%rsp)
4947
movl %r9d, 0x10(%rsp)
5048

51-
sgdt 0x14(%rsp)
49+
leaq 0x14(%rsp), %rbx
50+
sgdt (%rbx)
5251

5352
/*
5453
* Switch to gdt with 32-bit segments. This is the firmware GDT
@@ -68,8 +67,7 @@ SYM_FUNC_START(__efi64_thunk)
6867
pushq %rax
6968
lretq
7069

71-
1: lgdt 0x14(%rsp)
72-
addq $32, %rsp
70+
1: addq $32, %rsp
7371
movq %rdi, %rax
7472

7573
pop %rbx
@@ -175,14 +173,3 @@ SYM_DATA_END(efi32_boot_cs)
175173
SYM_DATA_START(efi32_boot_ds)
176174
.word 0
177175
SYM_DATA_END(efi32_boot_ds)
178-
179-
SYM_DATA_START(efi_gdt64)
180-
.word efi_gdt64_end - efi_gdt64
181-
.long 0 /* Filled out by user */
182-
.word 0
183-
.quad 0x0000000000000000 /* NULL descriptor */
184-
.quad 0x00af9a000000ffff /* __KERNEL_CS */
185-
.quad 0x00cf92000000ffff /* __KERNEL_DS */
186-
.quad 0x0080890000000000 /* TS descriptor */
187-
.quad 0x0000000000000000 /* TS continued */
188-
SYM_DATA_END_LABEL(efi_gdt64, SYM_L_LOCAL, efi_gdt64_end)

0 commit comments

Comments
 (0)