a46d674068
The variadic efi_call_phys() wrapper that exists on i386 was originally created to call into any EFI firmware runtime service, but in practice, we only use it once, to call SetVirtualAddressMap() during early boot. The flexibility provided by the variadic nature also makes it type unsafe, and makes the assembler code more complicated than needed, since it has to deal with an unknown number of arguments living on the stack. So clean this up, by renaming the helper to efi_call_svam(), and dropping the unneeded complexity. Let's also drop the reference to the efi_phys struct and grab the address from the EFI system table directly. Signed-off-by: Ard 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-9-ardb@kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
50 lines
961 B
ArmAsm
50 lines
961 B
ArmAsm
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* EFI call stub for IA32.
|
|
*
|
|
* This stub allows us to make EFI calls in physical mode with interrupts
|
|
* turned off.
|
|
*/
|
|
|
|
#include <linux/linkage.h>
|
|
#include <linux/init.h>
|
|
#include <asm/page_types.h>
|
|
|
|
__INIT
|
|
SYM_FUNC_START(efi_call_svam)
|
|
push 8(%esp)
|
|
push 8(%esp)
|
|
push %ecx
|
|
push %edx
|
|
|
|
/*
|
|
* Switch to the flat mapped alias of this routine, by jumping to the
|
|
* address of label '1' after subtracting PAGE_OFFSET from it.
|
|
*/
|
|
movl $1f, %edx
|
|
subl $__PAGE_OFFSET, %edx
|
|
jmp *%edx
|
|
1:
|
|
|
|
/* disable paging */
|
|
movl %cr0, %edx
|
|
andl $0x7fffffff, %edx
|
|
movl %edx, %cr0
|
|
|
|
/* convert the stack pointer to a flat mapped address */
|
|
subl $__PAGE_OFFSET, %esp
|
|
|
|
/* call the EFI routine */
|
|
call *(%eax)
|
|
|
|
/* convert ESP back to a kernel VA, and pop the outgoing args */
|
|
addl $__PAGE_OFFSET + 16, %esp
|
|
|
|
/* re-enable paging */
|
|
movl %cr0, %edx
|
|
orl $0x80000000, %edx
|
|
movl %edx, %cr0
|
|
|
|
ret
|
|
SYM_FUNC_END(efi_call_svam)
|