aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/boot/compressed/efi_thunk_64.S
diff options
context:
space:
mode:
authorArd Biesheuvel <ardb@kernel.org>2019-12-24 16:10:25 +0100
committerIngo Molnar <mingo@kernel.org>2019-12-25 10:49:26 +0100
commit0679715e714345d273c0e1eb78078535ffc4b2a1 (patch)
tree2f16e5a2898318fc0d08ea77f7c12d6a6d1919b5 /arch/x86/boot/compressed/efi_thunk_64.S
parentefi/libstub: Tidy up types and names of global cmdline variables (diff)
downloadlinux-dev-0679715e714345d273c0e1eb78078535ffc4b2a1.tar.xz
linux-dev-0679715e714345d273c0e1eb78078535ffc4b2a1.zip
efi/libstub/x86: Avoid globals to store context during mixed mode calls
Instead of storing the return address in a global variable when calling a 32-bit EFI service from the 64-bit stub, avoid the indirection via efi_exit32, and take the return address from the stack. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Cc: Arvind Sankar <nivedita@alum.mit.edu> Cc: Borislav Petkov <bp@alien8.de> Cc: James Morse <james.morse@arm.com> Cc: Matt Fleming <matt@codeblueprint.co.uk> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-efi@vger.kernel.org Link: https://lkml.kernel.org/r/20191224151025.32482-26-ardb@kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/boot/compressed/efi_thunk_64.S')
-rw-r--r--arch/x86/boot/compressed/efi_thunk_64.S17
1 files changed, 3 insertions, 14 deletions
diff --git a/arch/x86/boot/compressed/efi_thunk_64.S b/arch/x86/boot/compressed/efi_thunk_64.S
index 593913692d16..6d95eb6b8912 100644
--- a/arch/x86/boot/compressed/efi_thunk_64.S
+++ b/arch/x86/boot/compressed/efi_thunk_64.S
@@ -10,7 +10,7 @@
* needs to be able to service interrupts.
*
* On the plus side, we don't have to worry about mangling 64-bit
- * addresses into 32-bits because we're executing with an identify
+ * addresses into 32-bits because we're executing with an identity
* mapped pagetable and haven't transitioned to 64-bit virtual addresses
* yet.
*/
@@ -28,7 +28,7 @@ SYM_FUNC_START(efi64_thunk)
push %rbx
subq $8, %rsp
- leaq efi_exit32(%rip), %rax
+ leaq 1f(%rip), %rax
movl %eax, 4(%rsp)
leaq efi_gdt64(%rip), %rax
movl %eax, (%rsp)
@@ -55,9 +55,6 @@ SYM_FUNC_START(efi64_thunk)
sgdt save_gdt(%rip)
- leaq 1f(%rip), %rbx
- movq %rbx, func_rt_ptr(%rip)
-
/*
* Switch to gdt with 32-bit segments. This is the firmware GDT
* that was installed when the kernel started executing. This
@@ -72,6 +69,7 @@ SYM_FUNC_START(efi64_thunk)
lretq
1: addq $32, %rsp
+ movq %rdi, %rax
lgdt save_gdt(%rip)
@@ -99,13 +97,6 @@ SYM_FUNC_START(efi64_thunk)
ret
SYM_FUNC_END(efi64_thunk)
-SYM_FUNC_START_LOCAL(efi_exit32)
- movq func_rt_ptr(%rip), %rax
- push %rax
- mov %rdi, %rax
- ret
-SYM_FUNC_END(efi_exit32)
-
.code32
/*
* EFI service pointer must be in %edi.
@@ -186,8 +177,6 @@ SYM_DATA_START_LOCAL(save_gdt)
.quad 0
SYM_DATA_END(save_gdt)
-SYM_DATA_LOCAL(func_rt_ptr, .quad 0)
-
SYM_DATA_START(efi_gdt64)
.word efi_gdt64_end - efi_gdt64
.long 0 /* Filled out by user */