diff options
author | Dan Streetman <ddstreet@canonical.com> | 2019-08-13 13:02:33 +0200 |
---|---|---|
committer | Dan Streetman <ddstreet@canonical.com> | 2019-08-15 22:36:10 +0200 |
commit | 4287d0832c86a0b6a8ca8fe0163518c8d76cd0f1 (patch) | |
tree | 78873f695b24e11bb49b8945b47cedce7e15bbb3 /src | |
parent | src/boot/efi/shim: elide __attribute__((sysv_abi)) on non-intel archs (diff) | |
download | systemd-4287d0832c86a0b6a8ca8fe0163518c8d76cd0f1.tar.xz systemd-4287d0832c86a0b6a8ca8fe0163518c8d76cd0f1.zip |
src/boot/efi/linux: elide __attribute__((regparm(0))) on non-i386
This attribute is x86_32-only, so when building on non-intel archs it
generates a compiler warning. When building with -Werror this turns
into an error, so only include the attribute on i386 arch builds.
Diffstat (limited to 'src')
-rw-r--r-- | src/boot/efi/linux.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/boot/efi/linux.c b/src/boot/efi/linux.c index 5b623f4b71..00a3551e09 100644 --- a/src/boot/efi/linux.c +++ b/src/boot/efi/linux.c @@ -6,24 +6,24 @@ #include "linux.h" #include "util.h" -#ifdef __x86_64__ -typedef VOID(*handover_f)(VOID *image, EFI_SYSTEM_TABLE *table, struct boot_params *params); -static VOID linux_efi_handover(EFI_HANDLE image, struct boot_params *params) { - handover_f handover; - - asm volatile ("cli"); - handover = (handover_f)((UINTN)params->hdr.code32_start + 512 + params->hdr.handover_offset); - handover(image, ST, params); -} +#ifdef __i386__ +#define __regparm0__ __attribute__((regparm(0))) #else -typedef VOID(*handover_f)(VOID *image, EFI_SYSTEM_TABLE *table, struct boot_params *params) __attribute__((regparm(0))); +#define __regparm0__ +#endif + +typedef VOID(*handover_f)(VOID *image, EFI_SYSTEM_TABLE *table, struct boot_params *params) __regparm0__; static VOID linux_efi_handover(EFI_HANDLE image, struct boot_params *params) { handover_f handover; + UINTN start = (UINTN)params->hdr.code32_start; - handover = (handover_f)((UINTN)params->hdr.code32_start + params->hdr.handover_offset); +#ifdef __x86_64__ + asm volatile ("cli"); + start += 512; +#endif + handover = (handover_f)(start + params->hdr.handover_offset); handover(image, ST, params); } -#endif EFI_STATUS linux_exec(EFI_HANDLE *image, CHAR8 *cmdline, UINTN cmdline_len, |