summaryrefslogtreecommitdiff
path: root/loader
diff options
context:
space:
mode:
authorAda Christine <adachristine18@gmail.com>2022-03-19 18:12:29 +0000
committerAda Christine <adachristine18@gmail.com>2022-03-19 18:12:29 +0000
commiteb022d780afe1e5e92547b6b3c2369dde1c4cc0b (patch)
tree5085c0161ce9f3319a7208edcc6e7e297e0c433a /loader
parent66d66de4e0050ae00a55ae7003482f8f8af95d97 (diff)
_MSC_EXTENSIONS was causing empty definition of __attribute__ leading to calling convention issue in enter_shim
Diffstat (limited to 'loader')
-rw-r--r--loader/Makefile3
-rw-r--r--loader/main_efi.c14
2 files changed, 5 insertions, 12 deletions
diff --git a/loader/Makefile b/loader/Makefile
index d273258..add25e7 100644
--- a/loader/Makefile
+++ b/loader/Makefile
@@ -8,7 +8,8 @@ IMAGE := loader.efi
CPPFLAGS += -I../api -I../lib
CFLAGS += --target=$(GNUEFIARCH)-unknown-windows -fshort-wchar -mno-avx \
- -mno-sse -mno-mmx -funsigned-char -Wno-pointer-sign -ggdb
+ -mno-sse -mno-mmx -funsigned-char -Wno-pointer-sign -ggdb \
+ -fno-ms-extensions
LDFLAGS := --target=$(GNUEFIARCH)-unknown-windows -nostdlib -ggdb \
-Wl,-entry:efi_main,-subsystem:efi_application -fuse-ld=lld-link
diff --git a/loader/main_efi.c b/loader/main_efi.c
index 5e2a91d..866019e 100644
--- a/loader/main_efi.c
+++ b/loader/main_efi.c
@@ -464,20 +464,12 @@ static EFI_STATUS enter_shim(void)
{
EFI_STATUS status = EFI_ABORTED;
Elf64_Ehdr *ehdr = (Elf64_Ehdr *)shim_image.buffer_base;
- kc_entry_func entry;
+ efi_shim_entry_func entry;
- entry = (kc_entry_func)(shim_image.buffer_base + ehdr->e_entry);
+ entry = (efi_shim_entry_func)(shim_image.buffer_base + ehdr->e_entry);
kprintf("entering shim @%p\r\n", entry);
- __asm__ volatile
- (
- "mov %0, %%rax\n\t"
- "lea %1, %%rdi\n\t"
- "call *%%rax\n\t"
- :
- : "m"(entry), "m"(loader_interface)
- : "%rax", "%rdi"
- );
+ status = entry(&loader_interface);
return status;
}