blob: 4a69bbeb75770619ddc7129334097132cb8b626a [file] [log] [blame]
Lorenz Brun5d40c672021-09-28 15:06:37 +02001From d725d3cd472434c52e3c4bebbd7b242329d7a1b4 Mon Sep 17 00:00:00 2001
2From: Lorenz Brun <lorenz@monogon.tech>
3Date: Tue, 28 Sep 2021 05:21:10 +0200
4Subject: [PATCH] Use the SysV ABI calling into the kernel
5
6The original code expected to be compiled into a PE binary but
7internally still using the SysV ABI. Lots of trampolines are used to
8make that work as everything outside is using the MSVC ABI.
9The kernel also exposes the MSVC ABI using trampolines, but only for
10direct PE entrypoints. The EFI handover jump target does not do ABI
11conversion and thus matches the kernel's internal ABI, which is SysV.
12
13This means this call needs to be annotated as otherwise we'd call into
14the Kernel's EFI code using the MSVC ABI which is expecting SysV.
15Sigh.
16---
17 src/boot/efi/linux.c | 2 +-
18 1 file changed, 1 insertion(+), 1 deletion(-)
19
20diff --git a/src/boot/efi/linux.c b/src/boot/efi/linux.c
21index 5232a3ba40..0d58f39ff6 100644
22--- a/src/boot/efi/linux.c
23+++ b/src/boot/efi/linux.c
24@@ -12,7 +12,7 @@
25 #define __regparm0__
26 #endif
27
28-typedef VOID(*handover_f)(VOID *image, EFI_SYSTEM_TABLE *table, struct boot_params *params) __regparm0__;
29+typedef __attribute__((sysv_abi)) VOID(*handover_f)(VOID *image, EFI_SYSTEM_TABLE *table, struct boot_params *params) __regparm0__;
30
31 static VOID linux_efi_handover(EFI_HANDLE image, struct boot_params *params) {
32 handover_f handover;
33--
342.25.1
35