t6.c 1.1 KB

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