include/efi: Override EFIAPI macro for x86_64
This commit overrides the EFIAPI macro definition when using FSP on x86_64 to ensure the correct calling convention is used. On i386, there is no side-effect since the C calling convention used by coreboot and FSP are the same. However, on x86_64, FSP/UEFI uses the Microsoft x64 calling convention while coreboot uses the System V AMD64 ABI. This change resolves this incompatibility by setting EFIAPI to attribute((ms_abi)) on x86_64 when using FSP. TEST=Able to build google/rex0 in 32-bit and 64-bit mode. Change-Id: Ifae910be66d550af04cce5136d186a7e9dd085b3 Signed-off-by: Subrata Banik <subratabanik@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/82266 Reviewed-by: Ronak Kanabar <ronak.kanabar@intel.com> Reviewed-by: Eric Lai <ericllai@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
f5be5e4999
commit
cf5fc2312a
@ -3,6 +3,22 @@
|
||||
/* Create EFI equivalent datatype in coreboot based on UEFI specification */
|
||||
#ifndef __EFI_DATATYPE_H__
|
||||
#define __EFI_DATATYPE_H__
|
||||
|
||||
/*
|
||||
* EDK2 EFIAPI macro definition relies on compiler flags such as __GNUC__ which
|
||||
* is not working well when included by coreboot. While it has no side-effect on
|
||||
* i386 because the C calling convention used by coreboot and FSP are the same,
|
||||
* it breaks on x86_64 because FSP/UEFI uses the Microsoft x64 calling
|
||||
* convention while coreboot uses the System V AMD64 ABI.
|
||||
*
|
||||
* Fortunately, EDK2 header allows to override EFIAPI.
|
||||
*/
|
||||
#if CONFIG(PLATFORM_USES_FSP2_X86_32)
|
||||
#define EFIAPI __attribute__((regparm(0)))
|
||||
#else
|
||||
#define EFIAPI __attribute__((__ms_abi__))
|
||||
#endif
|
||||
|
||||
#include <Base.h>
|
||||
#include <Uefi/UefiBaseType.h>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user