[U-Boot] [PATCH v3] x86: use EFI calling convention for efi_main on x86_64

Alexander Graf agraf at suse.de
Sun Jun 3 12:09:54 UTC 2018



On 31.05.18 20:46, Ivan Gorinov wrote:
> 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.
> The arguments of efi_main() are also passed as unused arguments to the
> _relocate() function.
> 
> Save efi_main() arguments in the startup code on x86_64;
> use EFI calling convention for _relocate() on x86_64;
> remove unused _relocate() arguments;
> consistently use EFI calling convention for efi_main() everywhere.
> 
> Signed-off-by: Ivan Gorinov <ivan.gorinov at intel.com>

Looks good to me, but I haven't double-checked all registers to the
respective calling conventions. I'll leave that to Bin :)


Alex


More information about the U-Boot mailing list