1#include <efi.h> 2#include <efilib.h> 3 4typedef EFI_STATUS (*foo_t)(EFI_HANDLE, EFI_GUID *, VOID **); 5typedef struct { 6 unsigned long addr; 7 unsigned long gp; 8} fdesc_t; 9 10EFI_LOADED_IMAGE my_loaded; 11 12EFI_STATUS 13efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) 14{ 15 EFI_LOADED_IMAGE *loaded_image = NULL; 16#if 0 17 EFI_DEVICE_PATH *dev_path; 18#endif 19 EFI_STATUS status; 20 21 InitializeLib(image, systab); 22 status = uefi_call_wrapper(systab->BootServices->HandleProtocol, 23 3, 24 image, 25 &LoadedImageProtocol, 26 (void **) &loaded_image); 27 if (EFI_ERROR(status)) { 28 Print(L"handleprotocol: %r\n", status); 29 } 30 31#if 0 32 BS->HandleProtocol(loaded_image->DeviceHandle, &DevicePathProtocol, (void **) &dev_path); 33 34 Print(L"Image device : %s\n", DevicePathToStr(dev_path)); 35 Print(L"Image file : %s\n", DevicePathToStr(loaded_image->FilePath)); 36#endif 37 Print(L"Image base : %lx\n", loaded_image->ImageBase); 38 Print(L"Image size : %lx\n", loaded_image->ImageSize); 39 Print(L"Load options size : %lx\n", loaded_image->LoadOptionsSize); 40 Print(L"Load options : %s\n", loaded_image->LoadOptions); 41 42 return EFI_SUCCESS; 43} 44