Commit 89ed4865 authored by Ard Biesheuvel's avatar Ard Biesheuvel Committed by Ingo Molnar

efi/x86: Avoid redundant cast of EFI firmware service pointer

All EFI firmware call prototypes have been annotated as __efiapi,
permitting us to attach attributes regarding the calling convention
by overriding __efiapi to an architecture specific value.

On 32-bit x86, EFI firmware calls use the plain calling convention
where all arguments are passed via the stack, and cleaned up by the
caller. Let's add this to the __efiapi definition so we no longer
need to cast the function pointers before invoking them.
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Arvind Sankar <nivedita@alum.mit.edu>
Cc: Matthew Garrett <mjg59@google.com>
Cc: linux-efi@vger.kernel.org
Link: https://lkml.kernel.org/r/20200103113953.9571-6-ardb@kernel.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent ffc2760b
...@@ -51,13 +51,7 @@ extern asmlinkage unsigned long efi_call_phys(void *, ...); ...@@ -51,13 +51,7 @@ extern asmlinkage unsigned long efi_call_phys(void *, ...);
}) })
/* #define arch_efi_call_virt(p, f, args...) p->f(args)
* Wrap all the virtual calls in a way that forces the parameters on the stack.
*/
#define arch_efi_call_virt(p, f, args...) \
({ \
((efi_##f##_t __attribute__((regparm(0)))*) p->f)(args); \
})
#define efi_ioremap(addr, size, type, attr) ioremap_cache(addr, size) #define efi_ioremap(addr, size, type, attr) ioremap_cache(addr, size)
......
...@@ -48,8 +48,10 @@ typedef u16 efi_char16_t; /* UNICODE character */ ...@@ -48,8 +48,10 @@ typedef u16 efi_char16_t; /* UNICODE character */
typedef u64 efi_physical_addr_t; typedef u64 efi_physical_addr_t;
typedef void *efi_handle_t; typedef void *efi_handle_t;
#ifdef CONFIG_X86_64 #if defined(CONFIG_X86_64)
#define __efiapi __attribute__((ms_abi)) #define __efiapi __attribute__((ms_abi))
#elif defined(CONFIG_X86_32)
#define __efiapi __attribute__((regparm(0)))
#else #else
#define __efiapi #define __efiapi
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment