diff options
| author | Warner Losh <imp@FreeBSD.org> | 2025-11-18 04:44:07 +0000 |
|---|---|---|
| committer | Warner Losh <imp@FreeBSD.org> | 2025-11-18 04:45:59 +0000 |
| commit | 396b32e801d615954750162a616b4e9174b39916 (patch) | |
| tree | 858c3d7604f5e7ad2ec0d5f5657bf8434f1a6d99 | |
| parent | f6e9474ebdd53de5cf487c7bc9e0fa6743881c23 (diff) | |
stand: Add back missing EFIAPI define
EFIAPI has to be defined correctly for amd64, or things won't boot
because it uses a different API than we normally use. Normally, this
only affects amd64, since all the other archs are basically nothing.
Tested on: amd64, aarch64 and armv7 (the frist two by markj and I with
differnet test setups).
Fixes: 43b8edb32051
Sponsored by: Netflix
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D53799
| -rw-r--r-- | sys/sys/efi-edk2.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/sys/sys/efi-edk2.h b/sys/sys/efi-edk2.h index 513c56549803..b27b26bd613c 100644 --- a/sys/sys/efi-edk2.h +++ b/sys/sys/efi-edk2.h @@ -41,7 +41,20 @@ typedef void VOID; /* We can't actually call this stuff, so snip out API syntactic sugar */ #define INTERFACE_DECL(x) struct x +#ifdef _STANDALONE +#if defined(__amd64__) +#define EFIAPI __attribute__((ms_abi)) +#endif +#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options + #ifdef _MSC_EXTENSIONS + #define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler + #else + #define EFIAPI // Substitute expresion to force C calling convention + #endif +#endif +#else #define EFIAPI +#endif #define IN #define OUT #define CONST const @@ -64,11 +77,13 @@ typedef void VOID; #define PACKED /* - * Since we're not compiling for the UEFI boot time (which use ms abi - * conventions), tell EDK2 to define VA_START correctly. For the boot - * loader, this likely needs to be different. + * For userland and the kernel, we're not compiling for the UEFI boot time + * (which use ms abi conventions on amd64), tell EDK2 to define VA_START + * correctly. For the boot loader, we can't do that, so don't. */ +#ifndef _STANDALONE #define NO_MSABI_VA_FUNCS 1 +#endif /* * Finally, we need to define the processor we are in EDK2 terms. |
