efi: Drop all uses of efi_call_XX() wrappers

Now that GCC can generate function calls using the correct calling
convention for us, we can stop using the efi_call_XX() wrappers, and
just dereference the function pointers directly.

This avoids the untyped variadic wrapper routines, which means better
type checking for the method calls.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Ard Biesheuvel authored and Daniel Kiper committed 2023-05-25 16:48:00 +02:00
1 parent 6a080b9cde
commit bb4aa6e06e
23 files changed
+165 -170

No files matched your search

+4 -4
View File
@@ -40,7 +40,7 @@ grub_appleloader_unload (void)
grub_efi_boot_services_t *b;
b = grub_efi_system_table->boot_services;
efi_call_1 (b->unload_image, image_handle);
b->unload_image (image_handle);
grub_free (cmdline);
cmdline = 0;
@@ -55,7 +55,7 @@ grub_appleloader_boot (void)
grub_efi_boot_services_t *b;
b = grub_efi_system_table->boot_services;
efi_call_3 (b->start_image, image_handle, 0, 0);
b->start_image (image_handle, 0, 0);
grub_appleloader_unload ();
@@ -165,8 +165,8 @@ grub_cmd_appleloader (grub_command_t cmd __attribute__ ((unused)),
b = grub_efi_system_table->boot_services;
for (pdev = devs ; pdev->devpath ; pdev++)
if (efi_call_6 (b->load_image, 0, grub_efi_image_handle, pdev->devpath,
NULL, 0, &image_handle) == GRUB_EFI_SUCCESS)
if (b->load_image (0, grub_efi_image_handle, pdev->devpath,
NULL, 0, &image_handle) == GRUB_EFI_SUCCESS)
break;
if (! pdev->devpath)
+10 -10
View File
@@ -56,7 +56,7 @@ grub_chainloader_unload (void *context)
grub_free (loaded_image->load_options);
b = grub_efi_system_table->boot_services;
efi_call_1 (b->unload_image, image_handle);
b->unload_image (image_handle);
grub_dl_unref (my_mod);
return GRUB_ERR_NONE;
@@ -72,7 +72,7 @@ grub_chainloader_boot (void *context)
grub_efi_char16_t *exit_data = NULL;
b = grub_efi_system_table->boot_services;
status = efi_call_3 (b->start_image, image_handle, &exit_data_size, &exit_data);
status = b->start_image (image_handle, &exit_data_size, &exit_data);
if (status != GRUB_EFI_SUCCESS)
{
if (exit_data)
@@ -94,7 +94,7 @@ grub_chainloader_boot (void *context)
}
if (exit_data)
efi_call_1 (b->free_pool, exit_data);
b->free_pool (exit_data);
grub_loader_unset ();
@@ -289,7 +289,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
}
pages = (((grub_efi_uintn_t) size + ((1 << 12) - 1)) >> 12);
status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_ANY_PAGES,
status = b->allocate_pages (GRUB_EFI_ALLOCATE_ANY_PAGES,
GRUB_EFI_LOADER_CODE,
pages, &address);
if (status != GRUB_EFI_SUCCESS)
@@ -346,9 +346,9 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
}
#endif
status = efi_call_6 (b->load_image, 0, grub_efi_image_handle, file_path,
boot_image, size,
&image_handle);
status = b->load_image (0, grub_efi_image_handle, file_path,
boot_image, size,
&image_handle);
if (status != GRUB_EFI_SUCCESS)
{
if (status == GRUB_EFI_OUT_OF_RESOURCES)
@@ -403,7 +403,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
grub_device_close (dev);
/* We're finished with the source image buffer and file path now. */
efi_call_2 (b->free_pages, address, pages);
b->free_pages (address, pages);
grub_free (file_path);
grub_loader_set_ex (grub_chainloader_boot, grub_chainloader_unload, image_handle, 0);
@@ -421,10 +421,10 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
grub_free (file_path);
if (address)
efi_call_2 (b->free_pages, address, pages);
b->free_pages (address, pages);
if (image_handle != NULL)
efi_call_1 (b->unload_image, image_handle);
b->unload_image (image_handle);
grub_dl_unref (my_mod);