mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-01 17:10:11 +00:00
9f0b0113c9
UEFI specifies the calling convention used in Microsoft compilers; first arguments of a function are passed in (%rcx, %rdx, %r8, %r9). All other compilers use System V ABI by default, passing first integer arguments of a function in (%rdi, %rsi, %rdx, %rcx, %r8, %r9). These ABI also specify different sets of registers that must be preserved across function calls (callee-saved). GCC allows using the Microsoft calling convention by adding the ms_abi attribute to a function declaration. Current EFI implementation in U-Boot specifies EFIAPI for efi_main() in the test apps but uses default calling convention in lib/efi. Save efi_main() arguments in the startup code on x86_64; use EFI calling convention for _relocate() on x86_64; consistently use EFI calling convention for efi_main() everywhere. Signed-off-by: Ivan Gorinov <ivan.gorinov@intel.com> Reviewed-by: Alexander Graf <agraf@suse.de> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
53 lines
914 B
ArmAsm
53 lines
914 B
ArmAsm
/* SPDX-License-Identifier: BSD-3-Clause */
|
|
/*
|
|
* crt0-efi-x86_64.S - x86_64 EFI startup code.
|
|
* Copyright (C) 1999 Hewlett-Packard Co.
|
|
* Contributed by David Mosberger <davidm@hpl.hp.com>.
|
|
* Copyright (C) 2005 Intel Corporation
|
|
* Contributed by Fenghua Yu <fenghua.yu@intel.com>.
|
|
*
|
|
* All rights reserved.
|
|
*/
|
|
.text
|
|
.align 4
|
|
|
|
.globl _start
|
|
_start:
|
|
subq $8, %rsp
|
|
|
|
pushq %rcx
|
|
pushq %rdx
|
|
|
|
mov %rcx, %r8
|
|
mov %rdx, %r9
|
|
|
|
lea image_base(%rip), %rcx
|
|
lea _DYNAMIC(%rip), %rdx
|
|
|
|
call _relocate
|
|
|
|
popq %rdx
|
|
popq %rcx
|
|
|
|
testq %rax, %rax
|
|
jnz .exit
|
|
|
|
call efi_main
|
|
.exit:
|
|
addq $8, %rsp
|
|
|
|
ret
|
|
|
|
/*
|
|
* hand-craft a dummy .reloc section so EFI knows it's a relocatable
|
|
* executable:
|
|
*/
|
|
.data
|
|
dummy: .long 0
|
|
|
|
#define IMAGE_REL_ABSOLUTE 0
|
|
.section .reloc, "a"
|
|
label1:
|
|
.long dummy-label1 /* Page RVA */
|
|
.long 10 /* Block Size (2*4+2) */
|
|
.word (IMAGE_REL_ABSOLUTE << 12) + 0 /* reloc for dummy */
|