diff --git a/arch/x86/lib/crt0_x86_64_efi.S b/arch/x86/lib/crt0_x86_64_efi.S index 989799fb4a..bb8d3cf8a9 100644 --- a/arch/x86/lib/crt0_x86_64_efi.S +++ b/arch/x86/lib/crt0_x86_64_efi.S @@ -3,7 +3,7 @@ * crt0-efi-x86_64.S - x86_64 EFI startup code. * Copyright (C) 1999 Hewlett-Packard Co. * Contributed by David Mosberger . - * Copyright (C) 2005 Intel Co. + * Copyright (C) 2005 Intel Corporation * Contributed by Fenghua Yu . * * All rights reserved. @@ -14,26 +14,28 @@ .globl _start _start: subq $8, %rsp + pushq %rcx pushq %rdx -0: - lea image_base(%rip), %rdi - lea _DYNAMIC(%rip), %rsi + mov %rcx, %r8 + mov %rdx, %r9 + + lea image_base(%rip), %rcx + lea _DYNAMIC(%rip), %rdx - popq %rcx - popq %rdx - pushq %rcx - pushq %rdx call _relocate - popq %rdi - popq %rsi + popq %rdx + popq %rcx + + testq %rax, %rax + jnz .exit call efi_main +.exit: addq $8, %rsp -.exit: ret /* diff --git a/lib/efi/efi_app.c b/lib/efi/efi_app.c index c8280935c8..3eb8eeb677 100644 --- a/lib/efi/efi_app.c +++ b/lib/efi/efi_app.c @@ -96,7 +96,8 @@ static void free_memory(struct efi_priv *priv) * U-Boot. If it returns, EFI will continue. Another way to get back to EFI * is via reset_cpu(). */ -efi_status_t efi_main(efi_handle_t image, struct efi_system_table *sys_table) +efi_status_t EFIAPI efi_main(efi_handle_t image, + struct efi_system_table *sys_table) { struct efi_priv local_priv, *priv = &local_priv; efi_status_t ret; diff --git a/lib/efi/efi_stub.c b/lib/efi/efi_stub.c index 09023a2f67..9deffe220f 100644 --- a/lib/efi/efi_stub.c +++ b/lib/efi/efi_stub.c @@ -268,7 +268,8 @@ static void add_entry_addr(struct efi_priv *priv, enum efi_entry_t type, * This function is called by our EFI start-up code. It handles running * U-Boot. If it returns, EFI will continue. */ -efi_status_t efi_main(efi_handle_t image, struct efi_system_table *sys_table) +efi_status_t EFIAPI efi_main(efi_handle_t image, + struct efi_system_table *sys_table) { struct efi_priv local_priv, *priv = &local_priv; struct efi_boot_services *boot = sys_table->boottime;