From: Ard Biesheuvel <ardb@kernel.org>
To: linux-efi@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>
Cc: Ard Biesheuvel <ardb@kernel.org>,
linux-kernel@vger.kernel.org,
Arvind Sankar <nivedita@alum.mit.edu>
Subject: [PATCH 25/25] efi/libstub/x86: avoid globals to store context during mixed mode calls
Date: Tue, 24 Dec 2019 16:10:25 +0100 [thread overview]
Message-ID: <20191224151025.32482-26-ardb@kernel.org> (raw)
In-Reply-To: <20191224151025.32482-1-ardb@kernel.org>
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>
---
arch/x86/boot/compressed/efi_thunk_64.S | 17 +++--------------
1 file 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 */
--
2.20.1
next prev parent reply other threads:[~2019-12-24 15:11 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-24 15:10 [GIT PULL 00/25] EFI updates for v5.6 Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 01/25] efi/gop: Remove bogus packed attribute from GOP structures Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 02/25] efi/gop: Remove unused typedef Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 03/25] efi/gop: Convert GOP structures to typedef and cleanup some types Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 04/25] efi/gop: Unify 32/64-bit functions Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 05/25] efi/libstub: remove unused __efi_call_early() macro Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 06/25] efi/x86: rename efi_is_native() to efi_is_mixed() Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 07/25] efi/libstub: use a helper to iterate over a EFI handle array Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 08/25] efi/libstub: extend native protocol definitions with mixed_mode aliases Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 09/25] efi/libstub: distinguish between native/mixed not 32/64 bit Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 10/25] efi/libstub: drop explicit 32/64-bit protocol definitions Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 11/25] efi/libstub: use stricter typing for firmware function pointers Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 12/25] efi/libstub: annotate firmware routines as __efiapi Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 13/25] efi/libstub/x86: avoid thunking for native firmware calls Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 14/25] efi/libstub: avoid protocol wrapper for file I/O routines Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 15/25] efi/libstub: get rid of 'sys_table_arg' macro parameter Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 16/25] efi/libstub: unify the efi_char16_printk implementations Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 17/25] efi/libstub/x86: drop __efi_early() export and efi_config struct Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 18/25] efi/libstub: drop sys_table_arg from printk routines Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 19/25] efi/libstub: remove 'sys_table_arg' from all function prototypes Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 20/25] efi/libstub/x86: work around page freeing issue in mixed mode Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 21/25] efi/libstub: drop protocol argument from efi_call_proto() macro Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 22/25] efi/libstub: drop 'table' argument from efi_table_attr() macro Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 23/25] efi/libstub: rename efi_call_early/_runtime macros to be more intuitive Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 24/25] efi/libstub: tidy up types and names of global cmdline variables Ard Biesheuvel
2019-12-24 15:10 ` Ard Biesheuvel [this message]
2019-12-25 9:50 ` [GIT PULL 00/25] EFI updates for v5.6 Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191224151025.32482-26-ardb@kernel.org \
--to=ardb@kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=nivedita@alum.mit.edu \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).