* [PATCH] efi/x86: Drop the special GDT for the EFI thunk
@ 2020-05-23 22:15 Arvind Sankar
2020-05-23 22:40 ` Ard Biesheuvel
0 siblings, 1 reply; 2+ messages in thread
From: Arvind Sankar @ 2020-05-23 22:15 UTC (permalink / raw)
To: Ard Biesheuvel; +Cc: linux-efi, x86
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 <nivedita@alum.mit.edu>
---
arch/x86/boot/compressed/efi_thunk_64.S | 19 +++----------------
1 file changed, 3 insertions(+), 16 deletions(-)
diff --git a/arch/x86/boot/compressed/efi_thunk_64.S b/arch/x86/boot/compressed/efi_thunk_64.S
index 2b2049259619..c4bb0f9363f5 100644
--- a/arch/x86/boot/compressed/efi_thunk_64.S
+++ b/arch/x86/boot/compressed/efi_thunk_64.S
@@ -28,8 +28,6 @@ SYM_FUNC_START(__efi64_thunk)
push %rbx
leaq 1f(%rip), %rbp
- leaq efi_gdt64(%rip), %rbx
- movl %ebx, 2(%rbx) /* Fixup the gdt base address */
movl %ds, %eax
push %rax
@@ -48,7 +46,8 @@ SYM_FUNC_START(__efi64_thunk)
movl %r8d, 0xc(%rsp)
movl %r9d, 0x10(%rsp)
- sgdt 0x14(%rsp)
+ leaq 0x14(%rsp), %rbx
+ sgdt (%rbx)
/*
* Switch to gdt with 32-bit segments. This is the firmware GDT
@@ -68,8 +67,7 @@ SYM_FUNC_START(__efi64_thunk)
pushq %rax
lretq
-1: lgdt 0x14(%rsp)
- addq $32, %rsp
+1: addq $32, %rsp
movq %rdi, %rax
pop %rbx
@@ -175,14 +173,3 @@ SYM_DATA_END(efi32_boot_cs)
SYM_DATA_START(efi32_boot_ds)
.word 0
SYM_DATA_END(efi32_boot_ds)
-
-SYM_DATA_START(efi_gdt64)
- .word efi_gdt64_end - efi_gdt64
- .long 0 /* Filled out by user */
- .word 0
- .quad 0x0000000000000000 /* NULL descriptor */
- .quad 0x00af9a000000ffff /* __KERNEL_CS */
- .quad 0x00cf92000000ffff /* __KERNEL_DS */
- .quad 0x0080890000000000 /* TS descriptor */
- .quad 0x0000000000000000 /* TS continued */
-SYM_DATA_END_LABEL(efi_gdt64, SYM_L_LOCAL, efi_gdt64_end)
--
2.26.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] efi/x86: Drop the special GDT for the EFI thunk
2020-05-23 22:15 [PATCH] efi/x86: Drop the special GDT for the EFI thunk Arvind Sankar
@ 2020-05-23 22:40 ` Ard Biesheuvel
0 siblings, 0 replies; 2+ messages in thread
From: Ard Biesheuvel @ 2020-05-23 22:40 UTC (permalink / raw)
To: Arvind Sankar; +Cc: linux-efi, X86 ML
On Sun, 24 May 2020 at 00:15, Arvind Sankar <nivedita@alum.mit.edu> wrote:
>
> 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 <nivedita@alum.mit.edu>
Queued, thanks.
> ---
> arch/x86/boot/compressed/efi_thunk_64.S | 19 +++----------------
> 1 file changed, 3 insertions(+), 16 deletions(-)
>
> diff --git a/arch/x86/boot/compressed/efi_thunk_64.S b/arch/x86/boot/compressed/efi_thunk_64.S
> index 2b2049259619..c4bb0f9363f5 100644
> --- a/arch/x86/boot/compressed/efi_thunk_64.S
> +++ b/arch/x86/boot/compressed/efi_thunk_64.S
> @@ -28,8 +28,6 @@ SYM_FUNC_START(__efi64_thunk)
> push %rbx
>
> leaq 1f(%rip), %rbp
> - leaq efi_gdt64(%rip), %rbx
> - movl %ebx, 2(%rbx) /* Fixup the gdt base address */
>
> movl %ds, %eax
> push %rax
> @@ -48,7 +46,8 @@ SYM_FUNC_START(__efi64_thunk)
> movl %r8d, 0xc(%rsp)
> movl %r9d, 0x10(%rsp)
>
> - sgdt 0x14(%rsp)
> + leaq 0x14(%rsp), %rbx
> + sgdt (%rbx)
>
> /*
> * Switch to gdt with 32-bit segments. This is the firmware GDT
> @@ -68,8 +67,7 @@ SYM_FUNC_START(__efi64_thunk)
> pushq %rax
> lretq
>
> -1: lgdt 0x14(%rsp)
> - addq $32, %rsp
> +1: addq $32, %rsp
> movq %rdi, %rax
>
> pop %rbx
> @@ -175,14 +173,3 @@ SYM_DATA_END(efi32_boot_cs)
> SYM_DATA_START(efi32_boot_ds)
> .word 0
> SYM_DATA_END(efi32_boot_ds)
> -
> -SYM_DATA_START(efi_gdt64)
> - .word efi_gdt64_end - efi_gdt64
> - .long 0 /* Filled out by user */
> - .word 0
> - .quad 0x0000000000000000 /* NULL descriptor */
> - .quad 0x00af9a000000ffff /* __KERNEL_CS */
> - .quad 0x00cf92000000ffff /* __KERNEL_DS */
> - .quad 0x0080890000000000 /* TS descriptor */
> - .quad 0x0000000000000000 /* TS continued */
> -SYM_DATA_END_LABEL(efi_gdt64, SYM_L_LOCAL, efi_gdt64_end)
> --
> 2.26.2
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-23 22:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-23 22:15 [PATCH] efi/x86: Drop the special GDT for the EFI thunk Arvind Sankar
2020-05-23 22:40 ` Ard Biesheuvel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).